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.
This commit is contained in:
Ben Noordhuis 2023-11-27 00:59:30 +01:00 committed by GitHub
parent b5148b212e
commit 8be0358dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();