11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// Make sure that Node.js runs correctly with the --use-largepages option. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_cirequire('../common'); 61cb0ef41Sopenharmony_ciconst assert = require('assert'); 71cb0ef41Sopenharmony_ciconst { spawnSync } = require('child_process'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci{ 101cb0ef41Sopenharmony_ci const child = spawnSync(process.execPath, 111cb0ef41Sopenharmony_ci [ '--use-largepages=on', '-p', '42' ], 121cb0ef41Sopenharmony_ci { stdio: ['inherit', 'pipe', 'inherit'] }); 131cb0ef41Sopenharmony_ci const stdout = child.stdout.toString().match(/\S+/g); 141cb0ef41Sopenharmony_ci assert.strictEqual(child.status, 0); 151cb0ef41Sopenharmony_ci assert.strictEqual(child.signal, null); 161cb0ef41Sopenharmony_ci assert.strictEqual(stdout.length, 1); 171cb0ef41Sopenharmony_ci assert.strictEqual(stdout[0], '42'); 181cb0ef41Sopenharmony_ci} 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci{ 211cb0ef41Sopenharmony_ci const child = spawnSync(process.execPath, 221cb0ef41Sopenharmony_ci [ '--use-largepages=xyzzy', '-p', '42' ]); 231cb0ef41Sopenharmony_ci assert.strictEqual(child.status, 9); 241cb0ef41Sopenharmony_ci assert.strictEqual(child.signal, null); 251cb0ef41Sopenharmony_ci assert.strictEqual(child.stderr.toString().match(/\S+/g).slice(1).join(' '), 261cb0ef41Sopenharmony_ci 'invalid value for --use-largepages'); 271cb0ef41Sopenharmony_ci} 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ci// TODO(gabrielschulhof): Make assertions about the stderr, which may or may not 301cb0ef41Sopenharmony_ci// contain a message indicating that mapping to large pages has failed. 31