Unbreak run-test262 (#151)

Commit 8be0358dd7 broke `run-test262 -c test262.conf -a`, the delayed
parsing of the config file overwrote the effect of the `-a` flag.
This commit is contained in:
Ben Noordhuis 2023-11-28 22:42:22 +01:00 committed by GitHub
parent 5c136edbcf
commit 0ecb2c86b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1985,7 +1985,6 @@ int main(int argc, char **argv)
BOOL is_dir_list; BOOL is_dir_list;
BOOL only_check_errors = FALSE; BOOL only_check_errors = FALSE;
const char *filename; const char *filename;
const char *config = NULL;
const char *ignore = ""; const char *ignore = "";
BOOL is_test262_harness = FALSE; BOOL is_test262_harness = FALSE;
BOOL is_module = FALSE; BOOL is_module = FALSE;
@ -1996,6 +1995,18 @@ int main(int argc, char **argv)
setenv("TZ", "America/Los_Angeles", 1); setenv("TZ", "America/Los_Angeles", 1);
#endif #endif
optind = 1;
while (optind < argc) {
char *arg = argv[optind];
if (*arg != '-')
break;
optind++;
if (strstr("-c -d -e -x -f -r -E -T", arg))
optind++;
if (strstr("-d -f", arg))
ignore = "testdir"; // run only the tests from -d or -f
}
/* cannot use getopt because we want to pass the command line to /* cannot use getopt because we want to pass the command line to
the script */ the script */
optind = 1; optind = 1;
@ -2020,16 +2031,14 @@ int main(int argc, char **argv)
} else if (str_equal(arg, "-v")) { } else if (str_equal(arg, "-v")) {
verbose++; verbose++;
} else if (str_equal(arg, "-c")) { } else if (str_equal(arg, "-c")) {
config = get_opt_arg(arg, argv[optind++]); load_config(get_opt_arg(arg, argv[optind++]), ignore);
} else if (str_equal(arg, "-d")) { } else if (str_equal(arg, "-d")) {
ignore = "testdir"; // don't run all tests, just the ones from -d
enumerate_tests(get_opt_arg(arg, argv[optind++])); enumerate_tests(get_opt_arg(arg, argv[optind++]));
} else if (str_equal(arg, "-e")) { } else if (str_equal(arg, "-e")) {
error_filename = get_opt_arg(arg, argv[optind++]); error_filename = get_opt_arg(arg, argv[optind++]);
} else if (str_equal(arg, "-x")) { } else if (str_equal(arg, "-x")) {
namelist_load(&exclude_list, get_opt_arg(arg, argv[optind++])); namelist_load(&exclude_list, get_opt_arg(arg, argv[optind++]));
} else if (str_equal(arg, "-f")) { } else if (str_equal(arg, "-f")) {
ignore = "testdir"; // don't run all tests, just the one from -f
is_dir_list = FALSE; is_dir_list = FALSE;
} else if (str_equal(arg, "-r")) { } else if (str_equal(arg, "-r")) {
report_filename = get_opt_arg(arg, argv[optind++]); report_filename = get_opt_arg(arg, argv[optind++]);
@ -2047,9 +2056,6 @@ int main(int argc, char **argv)
} }
} }
if (config)
load_config(config, ignore);
if (optind >= argc && !test_list.count) if (optind >= argc && !test_list.count)
help(); help();