diff --git a/benchmark/child_process/spawn-echo.js b/benchmark/child_process/spawn-echo.js index 7c9e851aacb641..72822f87db8aba 100644 --- a/benchmark/child_process/spawn-echo.js +++ b/benchmark/child_process/spawn-echo.js @@ -1,15 +1,15 @@ 'use strict'; var common = require('../common.js'); var bench = common.createBenchmark(main, { - thousands: [1] + n: [1000] }); var spawn = require('child_process').spawn; function main(conf) { - var len = +conf.thousands * 1000; + var n = +conf.n; bench.start(); - go(len, len); + go(n, n); } function go(n, left) { diff --git a/test/sequential/test-benchmark-child-process.js b/test/sequential/test-benchmark-child-process.js new file mode 100644 index 00000000000000..4acad7d0f7bd9c --- /dev/null +++ b/test/sequential/test-benchmark-child-process.js @@ -0,0 +1,19 @@ +'use strict'; + +require('../common'); + +const assert = require('assert'); +const fork = require('child_process').fork; +const path = require('path'); + +const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js'); + +const child = fork(runjs, ['--set', 'dur=0.1', + '--set', 'n=1', + '--set', 'len=1', + 'child_process'], + {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}}); +child.on('exit', (code, signal) => { + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); +});