JavaScript-QuickJS
view release on metacpan or search on metacpan
quickjs/run-test262.c view on Meta::CPAN
if (slow_test_threshold != 0) {
ti = get_clock_ms();
} else {
ti = 0;
}
run_test(p, test_index);
if (slow_test_threshold != 0) {
ti = get_clock_ms() - ti;
if (ti >= slow_test_threshold)
fprintf(stderr, "\n%s (%d ms)\n", p, ti);
}
show_progress(FALSE);
}
test_index++;
}
show_progress(TRUE);
}
void help(void)
{
printf("run-test262 version " CONFIG_VERSION "\n"
"usage: run-test262 [options] {-f file ... | [dir_list] [index range]}\n"
"-h help\n"
"-a run tests in strict and nostrict modes\n"
"-m print memory usage summary\n"
"-n use new style harness\n"
"-N run test prepared by test262-harness+eshost\n"
"-s run tests in strict mode, skip @nostrict tests\n"
"-E only run tests from the error file\n"
"-u update error file\n"
"-v verbose: output error messages\n"
"-T duration display tests taking more than 'duration' ms\n"
"-c file read configuration from 'file'\n"
"-d dir run all test files in directory tree 'dir'\n"
"-e file load the known errors from 'file'\n"
"-f file execute single test from 'file'\n"
"-r file set the report file name (default=none)\n"
"-x file exclude tests listed in 'file'\n");
exit(1);
}
char *get_opt_arg(const char *option, char *arg)
{
if (!arg) {
fatal(2, "missing argument for option %s", option);
}
return arg;
}
int main(int argc, char **argv)
{
int optind, start_index, stop_index;
BOOL is_dir_list;
BOOL only_check_errors = FALSE;
const char *filename;
BOOL is_test262_harness = FALSE;
BOOL is_module = FALSE;
#if !defined(_WIN32)
/* Date tests assume California local time */
setenv("TZ", "America/Los_Angeles", 1);
#endif
/* cannot use getopt because we want to pass the command line to
the script */
optind = 1;
is_dir_list = TRUE;
while (optind < argc) {
char *arg = argv[optind];
if (*arg != '-')
break;
optind++;
if (str_equal(arg, "-h")) {
help();
} else if (str_equal(arg, "-m")) {
dump_memory++;
} else if (str_equal(arg, "-n")) {
new_style++;
} else if (str_equal(arg, "-s")) {
test_mode = TEST_STRICT;
} else if (str_equal(arg, "-a")) {
test_mode = TEST_ALL;
} else if (str_equal(arg, "-u")) {
update_errors++;
} else if (str_equal(arg, "-v")) {
verbose++;
} else if (str_equal(arg, "-c")) {
load_config(get_opt_arg(arg, argv[optind++]));
} else if (str_equal(arg, "-d")) {
enumerate_tests(get_opt_arg(arg, argv[optind++]));
} else if (str_equal(arg, "-e")) {
error_filename = get_opt_arg(arg, argv[optind++]);
} else if (str_equal(arg, "-x")) {
namelist_load(&exclude_list, get_opt_arg(arg, argv[optind++]));
} else if (str_equal(arg, "-f")) {
is_dir_list = FALSE;
} else if (str_equal(arg, "-r")) {
report_filename = get_opt_arg(arg, argv[optind++]);
} else if (str_equal(arg, "-E")) {
only_check_errors = TRUE;
} else if (str_equal(arg, "-T")) {
slow_test_threshold = atoi(get_opt_arg(arg, argv[optind++]));
} else if (str_equal(arg, "-N")) {
is_test262_harness = TRUE;
} else if (str_equal(arg, "--module")) {
is_module = TRUE;
} else {
fatal(1, "unknown option: %s", arg);
break;
}
}
if (optind >= argc && !test_list.count)
help();
if (is_test262_harness) {
return run_test262_harness_test(argv[optind], is_module);
}
error_out = stdout;
if (error_filename) {
( run in 0.415 second using v1.01-cache-2.11-cpan-70e19b8f4f1 )