Skip to content

Commit

Permalink
fixup! test: make test-worker-prof more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Aug 23, 2023
1 parent d966328 commit 7779fab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/sequential/test-worker-prof.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (process.argv[2] === 'child') {

const { Worker } = require('worker_threads');
const w = new Worker(fixtures.path('workload', 'spin.js'), {
env: { NODE_TEST_SPIN_MS: 100 }
env: { NODE_TEST_SPIN_MS: 1000 }
});

w.on('exit', common.mustCall(() => {
Expand Down Expand Up @@ -58,8 +58,8 @@ if (process.argv[2] === 'child') {
console.log('parent ticks', parentTicks.length);
// When not tracking Worker threads, only 1 or 2 ticks would
// have been recorded.
// prof_sampling_interval is by default 1 millsecond, so spinning for 100
// milliseconds should result in ~100 ticks.
// prof_sampling_interval is by default 1 millsecond. A higher NODE_TEST_SPIN_MS
// should result in more ticks, while 15 should be safe on most machines.
assert(workerTicks.length > 15, `worker ticks <= 15:\n${workerTicks.join('\n')}`);
assert(parentTicks.length > 15, `parent ticks <= 15:\n${parentTicks.join('\n')}`);
}

0 comments on commit 7779fab

Please sign in to comment.