Skip to content
Permalink
Browse files

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: #25503
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Coe <bencoe@gmail.com>
  • Loading branch information...
Trott authored and BridgeAR committed Jan 14, 2019
1 parent edab2d6 commit d7bc03e2ca09a80d8e76e2dd3c4c437260cb8e8c
Showing with 7 additions and 4 deletions.
  1. +7 −4 test/known_issues/test-vm-timeout-escape-queuemicrotask.js
@@ -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`
});

0 comments on commit d7bc03e

Please sign in to comment.
You can’t perform that action at this time.