Skip to content

Commit 8be0358

Browse files
authored
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.
1 parent b5148b2 commit 8be0358

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

run-test262.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ void update_exclude_dirs(void)
911911
lp->count = count;
912912
}
913913

914-
void load_config(const char *filename)
914+
void load_config(const char *filename, const char *ignore)
915915
{
916916
char buf[1024];
917917
FILE *f;
@@ -966,6 +966,10 @@ void load_config(const char *filename)
966966
printf("%s:%d: syntax error\n", filename, lineno);
967967
continue;
968968
}
969+
if (strstr(ignore, p)) {
970+
printf("%s:%d: ignoring %s=%s\n", filename, lineno, p, q);
971+
continue;
972+
}
969973
if (str_equal(p, "style")) {
970974
new_style = str_equal(q, "new");
971975
continue;
@@ -1981,6 +1985,8 @@ int main(int argc, char **argv)
19811985
BOOL is_dir_list;
19821986
BOOL only_check_errors = FALSE;
19831987
const char *filename;
1988+
const char *config = NULL;
1989+
const char *ignore = "";
19841990
BOOL is_test262_harness = FALSE;
19851991
BOOL is_module = FALSE;
19861992

@@ -2014,14 +2020,16 @@ int main(int argc, char **argv)
20142020
} else if (str_equal(arg, "-v")) {
20152021
verbose++;
20162022
} else if (str_equal(arg, "-c")) {
2017-
load_config(get_opt_arg(arg, argv[optind++]));
2023+
config = get_opt_arg(arg, argv[optind++]);
20182024
} else if (str_equal(arg, "-d")) {
2025+
ignore = "testdir"; // don't run all tests, just the ones from -d
20192026
enumerate_tests(get_opt_arg(arg, argv[optind++]));
20202027
} else if (str_equal(arg, "-e")) {
20212028
error_filename = get_opt_arg(arg, argv[optind++]);
20222029
} else if (str_equal(arg, "-x")) {
20232030
namelist_load(&exclude_list, get_opt_arg(arg, argv[optind++]));
20242031
} else if (str_equal(arg, "-f")) {
2032+
ignore = "testdir"; // don't run all tests, just the one from -f
20252033
is_dir_list = FALSE;
20262034
} else if (str_equal(arg, "-r")) {
20272035
report_filename = get_opt_arg(arg, argv[optind++]);
@@ -2039,6 +2047,9 @@ int main(int argc, char **argv)
20392047
}
20402048
}
20412049

2050+
if (config)
2051+
load_config(config, ignore);
2052+
20422053
if (optind >= argc && !test_list.count)
20432054
help();
20442055

0 commit comments

Comments
 (0)