node/test/parallel/test-startup-large-pages.js
Ben Noordhuis dbe881b64c
test: show child stderr output in largepages test
The test starts child processes. A recent change is suspected of causing
flaky crashes on one of the alpine buildbots but we can't know for sure
because the test hides the child's stderr.

Refs: https://github.com/nodejs/node/pull/31547#issuecomment-581076515

PR-URL: https://github.com/nodejs/node/pull/31612
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-02-02 13:41:37 +01:00

31 lines
1.1 KiB
JavaScript

'use strict';
// Make sure that Node.js runs correctly with the --use-largepages option.
require('../common');
const assert = require('assert');
const { spawnSync } = require('child_process');
{
const child = spawnSync(process.execPath,
[ '--use-largepages=on', '-p', '42' ],
{ stdio: ['inherit', 'pipe', 'inherit'] });
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=xyzzy', '-p', '42' ]);
assert.strictEqual(child.status, 9);
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stderr.toString().match(/\S+/g).slice(1).join(' '),
'invalid value for --use-largepages');
}
// TODO(gabrielschulhof): Make assertions about the stderr, which may or may not
// contain a message indicating that mapping to large pages has failed.