aboutsummaryrefslogtreecommitdiff
path: root/test/sequential/test-benchmark-child-process.js
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2017-08-24 03:15:55 -0400
committerRefael Ackermann <refack@gmail.com>2017-09-11 11:26:15 -0400
commit640b20616d2cdc46bc3df8703cdc1395578ff1b3 (patch)
tree1b2c71588159caccdddf90fa31aa3af988d31df5 /test/sequential/test-benchmark-child-process.js
parentc79fd2b9b109b310916d49c5958bfafcd98965ee (diff)
downloadandroid-node-v8-640b20616d2cdc46bc3df8703cdc1395578ff1b3.tar.gz
android-node-v8-640b20616d2cdc46bc3df8703cdc1395578ff1b3.tar.bz2
android-node-v8-640b20616d2cdc46bc3df8703cdc1395578ff1b3.zip
test: create shared runBenchmark function
Mostly shared/duplicated logic between all benchmark test files, so creating a new common module to store it. PR-URL: https://github.com/nodejs/node/pull/15004 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'test/sequential/test-benchmark-child-process.js')
-rw-r--r--test/sequential/test-benchmark-child-process.js37
1 files changed, 11 insertions, 26 deletions
diff --git a/test/sequential/test-benchmark-child-process.js b/test/sequential/test-benchmark-child-process.js
index f993238549..365777069b 100644
--- a/test/sequential/test-benchmark-child-process.js
+++ b/test/sequential/test-benchmark-child-process.js
@@ -2,29 +2,14 @@
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 env = Object.assign({}, process.env,
- { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
-
-const child = fork(
- runjs,
- [
- '--set', 'dur=0',
- '--set', 'n=1',
- '--set', 'len=1',
- '--set', 'params=1',
- '--set', 'methodName=execSync',
- 'child_process'
- ],
- { env }
-);
-
-child.on('exit', (code, signal) => {
- assert.strictEqual(code, 0);
- assert.strictEqual(signal, null);
-});
+const runBenchmark = require('../common/benchmark');
+
+runBenchmark('child_process',
+ [
+ 'dur=0',
+ 'n=1',
+ 'len=1',
+ 'params=1',
+ 'methodName=execSync',
+ ],
+ { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });