From 8be0358dd7b767e6665effb6157a77f0ab0de514 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 27 Nov 2023 00:59:30 +0100 Subject: [PATCH] Ignore testdir config when -d or -f is passed (#145) Otherwise it runs the whole test262 suite even though I just want to run a select few. --- run-test262.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/run-test262.c b/run-test262.c index 376833d..c94ffc8 100644 --- a/run-test262.c +++ b/run-test262.c @@ -911,7 +911,7 @@ void update_exclude_dirs(void) lp->count = count; } -void load_config(const char *filename) +void load_config(const char *filename, const char *ignore) { char buf[1024]; FILE *f; @@ -966,6 +966,10 @@ void load_config(const char *filename) printf("%s:%d: syntax error\n", filename, lineno); continue; } + if (strstr(ignore, p)) { + printf("%s:%d: ignoring %s=%s\n", filename, lineno, p, q); + continue; + } if (str_equal(p, "style")) { new_style = str_equal(q, "new"); continue; @@ -1981,6 +1985,8 @@ 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; @@ -2014,14 +2020,16 @@ int main(int argc, char **argv) } else if (str_equal(arg, "-v")) { verbose++; } else if (str_equal(arg, "-c")) { - load_config(get_opt_arg(arg, argv[optind++])); + config = get_opt_arg(arg, argv[optind++]); } 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++]); @@ -2039,6 +2047,9 @@ int main(int argc, char **argv) } } + if (config) + load_config(config, ignore); + if (optind >= argc && !test_list.count) help();