forked from nodejs/node
/
test-startup-large-pages.js
31 lines (26 loc) · 1.06 KB
/
test-startup-large-pages.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
// A sanity check: Make sure that Node.js runs correctly when running with the
// --use-largepages option.
require('../common');
const assert = require('assert');
const { spawnSync } = require('child_process');
{
const child = spawnSync(process.execPath,
[ '--use-largepages=1', '-p', '42' ]);
const stdout = child.stdout.toString().match(/\S+/g);
assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
assert.strictEqual(stdout.length, 1);
assert.strictEqual(stdout[0], '42');
}
{
const child = spawnSync(process.execPath,
[ '--use-largepages=3', '-p', '42' ]);
assert.strictEqual(child.status, 9);
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stderr.toString().match(/\S+/g).slice(1).join(' '),
'--use-largepages must be one of 0, 1, or 2');
}
// TODO(gabrielschulhof): Run with --use-largepages=2 and make assertions about
// the stderr, which may or may not contain a message indicating that mapping to
// large pages has failed.