Skip to content

Commit

Permalink
test: convert buffer benchmark to runBenchmark
Browse files Browse the repository at this point in the history
PR-URL: #15349
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
  • Loading branch information
maclover7 authored and jasnell committed Sep 20, 2017
1 parent 45cdbcf commit a906645
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions test/sequential/test-benchmark-buffer.js
Expand Up @@ -2,33 +2,23 @@

require('../common');

// Minimal test for buffer benchmarks. This makes sure the benchmarks aren't
// completely broken but nothing more than that.
const runBenchmark = require('../common/benchmark');

const assert = require('assert');
const fork = require('child_process').fork;
const path = require('path');
runBenchmark('buffers',
[
'aligned=true',
'args=1',
'encoding=utf8',
'len=2',
'method=',
'n=1',
'noAssert=true',
'pieces=1',
'pieceSize=1',
'search=@',
'size=1',
'source=array',
'type=',
'withTotalLength=0'

const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js');
const argv = ['--set', 'aligned=true',
'--set', 'args=1',
'--set', 'buffer=fast',
'--set', 'encoding=utf8',
'--set', 'len=2',
'--set', 'method=',
'--set', 'n=1',
'--set', 'noAssert=true',
'--set', 'pieces=1',
'--set', 'pieceSize=1',
'--set', 'search=@',
'--set', 'size=1',
'--set', 'source=array',
'--set', 'type=',
'--set', 'withTotalLength=0',
'buffers'];

const child = fork(runjs, argv);
child.on('exit', (code, signal) => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
});
]);

0 comments on commit a906645

Please sign in to comment.