@@ -8,7 +8,8 @@ if (!common.isMainThread)
8
8
common . skip ( 'process.chdir is not available in Workers' ) ;
9
9
10
10
const CODE =
11
- 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)' ;
11
+ 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1);' +
12
+ 'process.title = "foo"' ;
12
13
const FILE_NAME = 'node_trace.1.log' ;
13
14
14
15
const tmpdir = require ( '../common/tmpdir' ) ;
@@ -17,6 +18,7 @@ process.chdir(tmpdir.path);
17
18
18
19
const proc = cp . spawn ( process . execPath ,
19
20
[ '--trace-event-categories' , 'node.perf.usertiming' ,
21
+ '--title=bar' ,
20
22
'-e' , CODE ] ) ;
21
23
proc . once ( 'exit' , common . mustCall ( ( ) => {
22
24
assert ( common . fileExists ( FILE_NAME ) ) ;
@@ -32,5 +34,14 @@ proc.once('exit', common.mustCall(() => {
32
34
assert ( traces . some ( ( trace ) =>
33
35
trace . cat === '__metadata' && trace . name === 'version' &&
34
36
trace . args . node === process . versions . node ) ) ;
37
+ if ( ! common . isSunOS ) {
38
+ // Changing process.title is currently unsupported on SunOS/SmartOS
39
+ assert ( traces . some ( ( trace ) =>
40
+ trace . cat === '__metadata' && trace . name === 'process_name' &&
41
+ trace . args . name === 'foo' ) ) ;
42
+ assert ( traces . some ( ( trace ) =>
43
+ trace . cat === '__metadata' && trace . name === 'process_name' &&
44
+ trace . args . name === 'bar' ) ) ;
45
+ }
35
46
} ) ) ;
36
47
} ) ) ;
0 commit comments