Skip to content

Commit

Permalink
test: increase run time in test-worker-prof
Browse files Browse the repository at this point in the history
This test has occasionally been failing on Windows since it
was added, with 6 instead of 15 ticks being seen.

Increasing the duration of the test should make it more reliable.

PR-URL: #26172
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
addaleax committed Feb 21, 2019
1 parent 9144558 commit 44130cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/parallel/test-worker-prof.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (!common.isMainThread)
if (process.argv[2] === 'child') {
const spin = `
const start = Date.now();
while (Date.now() - start < 200);
while (Date.now() - start < 1000);
`;
new Worker(spin, { eval: true });
eval(spin);
Expand All @@ -32,10 +32,10 @@ for (const logfile of logfiles) {
const lines = fs.readFileSync(logfile, 'utf8').split('\n');
const ticks = lines.filter((line) => /^tick,/.test(line)).length;

// Test that at least 20 ticks have been recorded for both parent and child
// Test that at least 15 ticks have been recorded for both parent and child
// threads. When not tracking Worker threads, only 1 or 2 ticks would
// have been recorded.
// When running locally on x64 Linux, this number is usually at least 150
// When running locally on x64 Linux, this number is usually at least 700
// for both threads, so 15 seems like a very safe threshold.
assert(ticks >= 15, `${ticks} >= 15`);
}

0 comments on commit 44130cf

Please sign in to comment.