mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Make the timeout test more resilient
Since we don't keep timers sorted by deadline but by insertion order, the test is flaky in slow environments (GHA seemingly). Increase the timeouts to give it a bigger chance of success. ASan / UBSan builds are notoriously slow, so skip the test in those.
This commit is contained in:
parent
194c45c4b5
commit
54afb19745
3 changed files with 12 additions and 4 deletions
|
@ -128,6 +128,9 @@ add_link_options(
|
|||
)
|
||||
elseif(CONFIG_UBSAN)
|
||||
message(STATUS "Building with UBSan")
|
||||
add_compile_definitions(
|
||||
__UBSAN__=1
|
||||
)
|
||||
add_compile_options(
|
||||
-fsanitize=undefined
|
||||
-fno-sanitize-recover=all
|
||||
|
|
3
qjs.c
3
qjs.c
|
@ -140,6 +140,9 @@ static const JSCFunctionListEntry navigator_obj[] = {
|
|||
static const JSCFunctionListEntry global_obj[] = {
|
||||
JS_CFUNC_DEF("gc", 0, js_gc),
|
||||
JS_OBJECT_DEF("navigator", navigator_obj, countof(navigator_obj), JS_PROP_C_W_E),
|
||||
#if defined(__ASAN__) || defined(__UBSAN__)
|
||||
JS_PROP_INT32_DEF("__running_with_sanitizer__", 1, JS_PROP_C_W_E ),
|
||||
#endif
|
||||
};
|
||||
|
||||
/* also used to initialize the worker context */
|
||||
|
|
|
@ -277,11 +277,13 @@ function test_timeout()
|
|||
|
||||
function test_timeout_order()
|
||||
{
|
||||
if (globalThis.__running_with_sanitizer__) return;
|
||||
|
||||
var s = "";
|
||||
os.setTimeout(a, 1);
|
||||
os.setTimeout(b, 2);
|
||||
os.setTimeout(d, 5);
|
||||
function a() { s += "a"; os.setTimeout(c, 0); }
|
||||
os.setTimeout(a, 100);
|
||||
os.setTimeout(b, 200);
|
||||
os.setTimeout(d, 500);
|
||||
function a() { s += "a"; os.setTimeout(c, 200); }
|
||||
function b() { s += "b"; }
|
||||
function c() { s += "c"; }
|
||||
function d() { assert(s === "abc"); } // not "acb"
|
||||
|
|
Loading…
Reference in a new issue