• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3// Make sure that Node.js runs correctly with the --use-largepages option.
4
5require('../common');
6const assert = require('assert');
7const { spawnSync } = require('child_process');
8
9{
10  const child = spawnSync(process.execPath,
11                          [ '--use-largepages=on', '-p', '42' ],
12                          { stdio: ['inherit', 'pipe', 'inherit'] });
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}
19
20{
21  const child = spawnSync(process.execPath,
22                          [ '--use-largepages=xyzzy', '-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                     'invalid value for --use-largepages');
27}
28
29// TODO(gabrielschulhof): Make assertions about the stderr, which may or may not
30// contain a message indicating that mapping to large pages has failed.
31