示例#1
0
void CompilerTest::run_tests(JVM_SINGLE_ARG_TRAPS) {
  UsingFastOops fast_oops;
  ObjArray::Fast classes;
  ObjArray::Fast methods;
  InstanceClass::Fast klass;
  Method::Fast m;

  Os::suspend_profiler();
  {
    classes = load_and_sort_classes(JVM_SINGLE_ARG_CHECK);
  }
  Os::resume_profiler();

  int num_classes = classes().length();
  for (int i=0; i<num_classes; i++) {
    klass = classes().obj_at(i);

    Os::suspend_profiler();
    {
      methods = sort_methods(&klass JVM_CHECK);
    }
    Os::resume_profiler();

    if (Verbose) {
      tty->print("Compiling class: ");
      klass().print_name_on(tty);
      tty->cr();
    }

    int num_methods = methods().length();
    for (int j=0; j<num_methods; j++) {
      m = methods().obj_at(j);
      if (m.not_null()
          && !m().is_impossible_to_compile() && !m().is_abstract()) {
        test_compile(&m JVM_CHECK);
      }
    }
  }

  Os::suspend_profiler();
  {
    print_summary();
  }
  Os::resume_profiler();
}
示例#2
0
int main(int argc, char *argv[])
{
    if (argc > 1) {
        fprintf(stderr, "%s takes no arguments\n", argv[0]);
        return 1;
    }
    test_term_simple();
    test_expression_add();
    test_expression_subtract();
    test_factor();
    test_mul_two_factor_term();
    test_div_two_factor_term();
    test_paren_factor();
    test_negative_expr();
    test_declaration();
    test_assignment();
    test_compile_inner();
    test_compile();

    return 0;
}
示例#3
0
int
main(int argc, char **argv)
{
	int optc;
	int optC = 0;

	while ((optc = getopt(argc, argv, "DdfCs:c:")) != EOF) {
		switch (optc) {
		case 'd':
			test_set_debug();
			break;
		case 'f':
			test_set_force();
			break;
		case 'D':
			test_set_debug();
			extra_debug++;
			break;
		case 'c':
			compilation = optarg;
			break;
		case 'C':
			optC++;
			break;
		case 's':
			sym = optarg;
			break;
		default:
			(void) fprintf(stderr, "Usage: %s [-df]\n", argv[0]);
			exit(1);
		}
	}

	if (test_load_config(NULL, compilation,
	    "env", do_env, "env_group", do_env_group, NULL) < 0) {
		exit(1);
	}

	while (optind < argc) {
		if (test_load_config(NULL, argv[optind++],
		    "type", do_type,
		    "value", do_value,
		    "define", do_define,
		    "func", do_func,
		    NULL) < 0) {
			exit(1);
		}
	}

	if (atexit(cleanup) != 0) {
		perror("atexit");
		exit(1);
	}

	if (custr_alloc(&st_custr) == -1) {
		perror("custr");
		exit(1);
	}

	if (mkworkdir() < 0) {
		perror("mkdir");
		exit(1);
	}

	find_compiler();
	if (!optC)
		test_compile();

	exit(0);
}