Skip to content

Commit 0ecb2c8

Browse files
authored
Unbreak run-test262 (#151)
Commit 8be0358 broke `run-test262 -c test262.conf -a`, the delayed parsing of the config file overwrote the effect of the `-a` flag.
1 parent 5c136ed commit 0ecb2c8

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

run-test262.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,6 @@ int main(int argc, char **argv)
19851985
BOOL is_dir_list;
19861986
BOOL only_check_errors = FALSE;
19871987
const char *filename;
1988-
const char *config = NULL;
19891988
const char *ignore = "";
19901989
BOOL is_test262_harness = FALSE;
19911990
BOOL is_module = FALSE;
@@ -1996,6 +1995,18 @@ int main(int argc, char **argv)
19961995
setenv("TZ", "America/Los_Angeles", 1);
19971996
#endif
19981997

1998+
optind = 1;
1999+
while (optind < argc) {
2000+
char *arg = argv[optind];
2001+
if (*arg != '-')
2002+
break;
2003+
optind++;
2004+
if (strstr("-c -d -e -x -f -r -E -T", arg))
2005+
optind++;
2006+
if (strstr("-d -f", arg))
2007+
ignore = "testdir"; // run only the tests from -d or -f
2008+
}
2009+
19992010
/* cannot use getopt because we want to pass the command line to
20002011
the script */
20012012
optind = 1;
@@ -2020,16 +2031,14 @@ int main(int argc, char **argv)
20202031
} else if (str_equal(arg, "-v")) {
20212032
verbose++;
20222033
} else if (str_equal(arg, "-c")) {
2023-
config = get_opt_arg(arg, argv[optind++]);
2034+
load_config(get_opt_arg(arg, argv[optind++]), ignore);
20242035
} else if (str_equal(arg, "-d")) {
2025-
ignore = "testdir"; // don't run all tests, just the ones from -d
20262036
enumerate_tests(get_opt_arg(arg, argv[optind++]));
20272037
} else if (str_equal(arg, "-e")) {
20282038
error_filename = get_opt_arg(arg, argv[optind++]);
20292039
} else if (str_equal(arg, "-x")) {
20302040
namelist_load(&exclude_list, get_opt_arg(arg, argv[optind++]));
20312041
} else if (str_equal(arg, "-f")) {
2032-
ignore = "testdir"; // don't run all tests, just the one from -f
20332042
is_dir_list = FALSE;
20342043
} else if (str_equal(arg, "-r")) {
20352044
report_filename = get_opt_arg(arg, argv[optind++]);
@@ -2047,9 +2056,6 @@ int main(int argc, char **argv)
20472056
}
20482057
}
20492058

2050-
if (config)
2051-
load_config(config, ignore);
2052-
20532059
if (optind >= argc && !test_list.count)
20542060
help();
20552061

0 commit comments

Comments
 (0)