Skip to content

Commit 4163d13

Browse files
ivankrasaghul
authored andcommitted
Add run-test262 --no-can-block flag
The flag is needed to pass the two CanBlockIsFalse tests from test262 when running individual preprocessed tests via run-test262 -N. Fixes #1431
1 parent f4b23b2 commit 4163d13

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

run-test262.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,15 +1988,14 @@ int run_test(ThreadLocalStorage *tls, const char *filename, int *msec)
19881988

19891989
/* run a test when called by test262-harness+eshost */
19901990
int run_test262_harness_test(ThreadLocalStorage *tls, const char *filename,
1991-
bool is_module)
1991+
bool is_module, bool can_block)
19921992
{
19931993
JSRuntime *rt;
19941994
JSContext *ctx;
19951995
char *buf;
19961996
size_t buf_len;
19971997
int eval_flags, ret_code, ret;
19981998
JSValue res_val;
1999-
bool can_block;
20001999

20012000
outfile = stdout; /* for js_print_262 */
20022001

@@ -2013,7 +2012,6 @@ int run_test262_harness_test(ThreadLocalStorage *tls, const char *filename,
20132012
}
20142013
JS_SetRuntimeInfo(rt, filename);
20152014

2016-
can_block = true;
20172015
JS_SetCanBlock(rt, can_block);
20182016

20192017
/* loader for ES6 modules */
@@ -2136,7 +2134,8 @@ void help(void)
21362134
"-d dir run all test files in directory tree 'dir'\n"
21372135
"-e file load the known errors from 'file'\n"
21382136
"-f file execute single test from 'file'\n"
2139-
"-x file exclude tests listed in 'file'\n",
2137+
"-x file exclude tests listed in 'file'\n"
2138+
"--no-can-block set [[CanBlock]] to false (Atomics.wait will throw)\n",
21402139
JS_GetVersion());
21412140
exit(1);
21422141
}
@@ -2159,6 +2158,7 @@ int main(int argc, char **argv)
21592158
const char *ignore = "";
21602159
bool is_test262_harness = false;
21612160
bool is_module = false;
2161+
bool can_block = true;
21622162
bool enable_progress = true;
21632163

21642164
js_std_set_worker_new_context_func(JS_NewCustomContext);
@@ -2227,6 +2227,8 @@ int main(int argc, char **argv)
22272227
is_test262_harness = true;
22282228
} else if (str_equal(arg, "--module")) {
22292229
is_module = true;
2230+
} else if (str_equal(arg, "--no-can-block")) {
2231+
can_block = false;
22302232
} else {
22312233
fatal(1, "unknown option: %s", arg);
22322234
break;
@@ -2237,7 +2239,7 @@ int main(int argc, char **argv)
22372239
help();
22382240

22392241
if (is_test262_harness) {
2240-
return run_test262_harness_test(tls, argv[optind], is_module);
2242+
return run_test262_harness_test(tls, argv[optind], is_module, can_block);
22412243
}
22422244

22432245
nthreads = max_int(nthreads, 1);

0 commit comments

Comments
 (0)