From 0ecb2c86b530e676fbe9ebef86f17b1e03d140dc Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 28 Nov 2023 22:42:22 +0100 Subject: [PATCH] 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. --- run-test262.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/run-test262.c b/run-test262.c index c94ffc8..cbc2eda 100644 --- a/run-test262.c +++ b/run-test262.c @@ -1985,7 +1985,6 @@ int main(int argc, char **argv) BOOL is_dir_list; BOOL only_check_errors = FALSE; const char *filename; - const char *config = NULL; const char *ignore = ""; BOOL is_test262_harness = FALSE; BOOL is_module = FALSE; @@ -1996,6 +1995,18 @@ int main(int argc, char **argv) setenv("TZ", "America/Los_Angeles", 1); #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 the script */ optind = 1; @@ -2020,16 +2031,14 @@ int main(int argc, char **argv) } else if (str_equal(arg, "-v")) { verbose++; } 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")) { - ignore = "testdir"; // don't run all tests, just the ones from -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")) { - ignore = "testdir"; // don't run all tests, just the one from -f is_dir_list = FALSE; } else if (str_equal(arg, "-r")) { 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) help();