@@ -7,13 +7,25 @@ require('../common');
77const assert = require ( 'assert' ) ;
88const { spawnSync } = require ( 'child_process' ) ;
99
10- const child = spawnSync ( process . execPath , [ '--use-largepages' , '-p' , '42' ] ) ;
11- const stdout = child . stdout . toString ( ) . match ( / \S + / g) ;
10+ {
11+ const child = spawnSync ( process . execPath ,
12+ [ '--use-largepages=1' , '-p' , '42' ] ) ;
13+ const stdout = child . stdout . toString ( ) . match ( / \S + / g) ;
14+ assert . strictEqual ( child . status , 0 ) ;
15+ assert . strictEqual ( child . signal , null ) ;
16+ assert . strictEqual ( stdout . length , 1 ) ;
17+ assert . strictEqual ( stdout [ 0 ] , '42' ) ;
18+ }
1219
13- assert . strictEqual ( child . status , 0 ) ;
14- assert . strictEqual ( child . signal , null ) ;
15- assert . strictEqual ( stdout . length , 1 ) ;
16- assert . strictEqual ( stdout [ 0 ] , '42' ) ;
20+ {
21+ const child = spawnSync ( process . execPath ,
22+ [ '--use-largepages=3' , '-p' , '42' ] ) ;
23+ assert . strictEqual ( child . status , 9 ) ;
24+ assert . strictEqual ( child . signal , null ) ;
25+ assert . strictEqual ( child . stderr . toString ( ) . match ( / \S + / g) . slice ( 1 ) . join ( ' ' ) ,
26+ '--use-largepages must be one of 0, 1, or 2' ) ;
27+ }
1728
18- // TODO(gabrielschulhof): Make assertions about the stderr, which may or may not
19- // contain a message indicating that mapping to large pages has failed.
29+ // TODO(gabrielschulhof): Run with --use-largepages=2 and make assertions about
30+ // the stderr, which may or may not contain a message indicating that mapping to
31+ // large pages has failed.
0 commit comments