test: improve known_issues/test-vm-timeout-escape-queuemicrotask
Improve known_issues/test-vm-timeout-escape-queuemicrotask to mitigate CI failures on ubuntu1604-arm64. Failures are due to a race condition. Use `common.platformTimeout()` to help, adjust timeout to make sure `queueMicrotasks()` has a chance to run, and improve error message. PR-URL: https://github.com/nodejs/node/pull/25503 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Coe <bencoe@gmail.com>
This commit is contained in:
parent
f216d5bbb1
commit
27f6d04dcf
@ -12,14 +12,17 @@ const NS_PER_MS = 1000000n;
|
||||
|
||||
const hrtime = process.hrtime.bigint;
|
||||
|
||||
const loopDuration = common.platformTimeout(100n);
|
||||
const timeout = common.platformTimeout(10);
|
||||
|
||||
function loop() {
|
||||
const start = hrtime();
|
||||
while (1) {
|
||||
const current = hrtime();
|
||||
const span = (current - start) / NS_PER_MS;
|
||||
if (span >= 100n) {
|
||||
if (span >= loopDuration) {
|
||||
throw new Error(
|
||||
`escaped timeout at ${span} milliseconds!`);
|
||||
`escaped ${timeout}ms timeout at ${span}ms`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,9 +35,9 @@ assert.throws(() => {
|
||||
queueMicrotask,
|
||||
loop
|
||||
},
|
||||
{ timeout: common.platformTimeout(5) }
|
||||
{ timeout }
|
||||
);
|
||||
}, {
|
||||
code: 'ERR_SCRIPT_EXECUTION_TIMEOUT',
|
||||
message: 'Script execution timed out after 5ms'
|
||||
message: `Script execution timed out after ${timeout}ms`
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user