@@ -23,17 +23,17 @@ if (process.argv[2] === 'child') {
2323 const fs = require('fs');
2424 const { Worker, parentPort } = require('worker_threads');
2525 parentPort.on('message', (m) => {
26- if (counter++ === 10 )
26+ if (counter++ === 1024 )
2727 process.exit(0);
28- parentPort.postMessage(
29- fs.readFileSync(m.toString()).slice(0, 1024 * 1024));
28+ parentPort.postMessage(
29+ fs.readFileSync(m.toString()).slice(0, 1024 * 1024));
3030 });
3131 ` ;
3232
3333 const { Worker } = require ( 'worker_threads' ) ;
3434 const w = new Worker ( pingpong , { eval : true } ) ;
3535 w . on ( 'message' , ( m ) => {
36- w . postMessage ( process . execPath ) ;
36+ w . postMessage ( __filename ) ;
3737 } ) ;
3838
3939 w . on ( 'exit' , common . mustCall ( ( ) => {
@@ -46,12 +46,13 @@ if (process.argv[2] === 'child') {
4646 }
4747 process . exit ( 0 ) ;
4848 } ) ) ;
49- w . postMessage ( process . execPath ) ;
49+ w . postMessage ( __filename ) ;
5050} else {
5151 tmpdir . refresh ( ) ;
52+ const timeout = common . platformTimeout ( 30_000 ) ;
5253 const spawnResult = spawnSync (
5354 process . execPath , [ '--prof' , __filename , 'child' ] ,
54- { cwd : tmpdir . path , encoding : 'utf8' , timeout : 30_000 } ) ;
55+ { cwd : tmpdir . path , encoding : 'utf8' , timeout } ) ;
5556 assert . strictEqual ( spawnResult . stderr . toString ( ) , '' ,
5657 `child exited with an error: \
5758 ${ util . inspect ( spawnResult ) } ` ) ;
@@ -72,7 +73,7 @@ if (process.argv[2] === 'child') {
7273 // Test that at least 15 ticks have been recorded for both parent and child
7374 // threads. When not tracking Worker threads, only 1 or 2 ticks would
7475 // have been recorded.
75- // When running locally on x64 Linux , this number is usually at least 200
76+ // When running locally, this number is usually around 200
7677 // for both threads, so 15 seems like a very safe threshold.
7778 assert ( ticks >= 15 , `${ ticks } >= 15` ) ;
7879 }
0 commit comments