Skip to content

Commit

Permalink
test: refactor all benchmark tests to use the new test option
Browse files Browse the repository at this point in the history
PR-URL: nodejs#31396
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
BridgeAR committed Feb 9, 2020
1 parent dac5795 commit 78aa348
Show file tree
Hide file tree
Showing 32 changed files with 34 additions and 322 deletions.
13 changes: 1 addition & 12 deletions test/benchmark/test-benchmark-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark(
'assert',
[
'strict=1',
'len=1',
'method=',
'n=1',
'primitive=null',
'size=1',
'type=Int8Array'
]
);
runBenchmark('assert');
9 changes: 1 addition & 8 deletions test/benchmark/test-benchmark-async-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,4 @@ if (!common.enoughTestMem)

const runBenchmark = require('../common/benchmark');

runBenchmark('async_hooks',
[
'asyncHooks=all',
'connections=50',
'method=trackingDisabled',
'n=10'
],
{});
runBenchmark('async_hooks');
28 changes: 1 addition & 27 deletions test/benchmark/test-benchmark-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('buffers',
[
'aligned=true',
'args=1',
'buffer=fast',
'bytes=0',
'byteLength=1',
'charsPerLine=6',
'difflen=false',
'encoding=utf8',
'endian=BE',
'extraSize=1',
'len=256',
'linesCount=1',
'method=',
'n=1',
'partial=true',
'pieces=1',
'pieceSize=1',
'search=@',
'size=1',
'source=array',
'type=',
'value=0',
'withTotalLength=0'
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('buffers', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
10 changes: 1 addition & 9 deletions test/benchmark/test-benchmark-child-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('child_process',
[
'dur=0',
'n=1',
'len=1',
'params=1',
'methodName=execSync',
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('child_process', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
7 changes: 1 addition & 6 deletions test/benchmark/test-benchmark-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('cluster', [
'n=1',
'payload=string',
'sendsPerBroadcast=1',
'serialization=json',
]);
runBenchmark('cluster');
16 changes: 1 addition & 15 deletions test/benchmark/test-benchmark-crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,4 @@ if (common.hasFipsCrypto)

const runBenchmark = require('../common/benchmark');

runBenchmark('crypto',
[
'algo=sha256',
'api=stream',
'cipher=',
'keylen=1024',
'len=1',
'n=1',
'out=buffer',
'size=1',
'type=buf',
'v=crypto',
'writes=1',
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('crypto', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
13 changes: 3 additions & 10 deletions test/benchmark/test-benchmark-dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ require('../common');

const runBenchmark = require('../common/benchmark');

// Because the dgram benchmarks use hardcoded ports, this should be in
// sequential rather than parallel to make sure it does not conflict with
// tests that choose random available ports.
// Dgram benchmarks use hardcoded ports. Thus, this test can not be run in
// parallel with tests that choose random ports.

runBenchmark('dgram', ['address=true',
'chunks=2',
'dur=0.1',
'len=1',
'n=1',
'num=1',
'type=send']);
runBenchmark('dgram');
4 changes: 1 addition & 3 deletions test/benchmark/test-benchmark-dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

const env = { ...process.env, NODEJS_BENCHMARK_ZERO_ALLOWED: 1 };

runBenchmark('dns', ['n=1', 'all=false', 'name=127.0.0.1'], env);
runBenchmark('dns', { ...process.env, NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
2 changes: 1 addition & 1 deletion test/benchmark/test-benchmark-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('domain', ['n=1', 'args=0']);
runBenchmark('domain');
13 changes: 1 addition & 12 deletions test/benchmark/test-benchmark-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('es',
[
'method=',
'count=1',
'context=null',
'rest=0',
'mode=',
'n=1',
'encoding=ascii',
'size=1e1'
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('es', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
4 changes: 1 addition & 3 deletions test/benchmark/test-benchmark-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('events',
['argc=0', 'listeners=1', 'n=1'],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('events', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
17 changes: 1 addition & 16 deletions test/benchmark/test-benchmark-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,4 @@ const runBenchmark = require('../common/benchmark');
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();

runBenchmark('fs', [
'bufferSize=32',
'concurrent=1',
'dir=.github',
'dur=0.1',
'encodingType=buf',
'filesize=1024',
'len=1024',
'mode=callback',
'n=1',
'pathType=relative',
'size=1',
'statSyncType=fstatSync',
'statType=fstat',
'withFileTypes=false',
], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('fs', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
25 changes: 1 addition & 24 deletions test/benchmark/test-benchmark-http.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,4 @@ if (!common.enoughTestMem)

const runBenchmark = require('../common/benchmark');

runBenchmark('http',
[
'benchmarker=test-double-http',
'arg=string',
'c=1',
'chunkedEnc=true',
'chunks=0',
'dur=0.1',
'e=0',
'input=keep-alive',
'key=""',
'len=1',
'method=write',
'n=1',
'res=normal',
'type=asc',
'url=long',
'value=X-Powered-By',
'w=0',
],
{
NODEJS_BENCHMARK_ZERO_ALLOWED: 1,
duration: 0
});
runBenchmark('http', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
15 changes: 1 addition & 14 deletions test/benchmark/test-benchmark-http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,4 @@ if (!common.enoughTestMem)

const runBenchmark = require('../common/benchmark');

runBenchmark('http2',
[
'benchmarker=test-double-http2',
'clients=1',
'length=65536',
'n=1',
'nheaders=0',
'requests=1',
'streams=1'
],
{
NODEJS_BENCHMARK_ZERO_ALLOWED: 1,
duration: 0
});
runBenchmark('http2', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
12 changes: 1 addition & 11 deletions test/benchmark/test-benchmark-misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('misc', [
'concat=0',
'dur=0.1',
'method=',
'n=1',
'type=',
'code=1',
'val=magyarország.icom.museum',
'script=test/fixtures/semicolon',
'mode=worker'
], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('misc', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
10 changes: 1 addition & 9 deletions test/benchmark/test-benchmark-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('module', [
'cache=true',
'dir=rel',
'ext=',
'fullPath=true',
'n=1',
'name=/',
'useCache=true',
]);
runBenchmark('module');
8 changes: 1 addition & 7 deletions test/benchmark/test-benchmark-napi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,4 @@ if (process.features.debug) {
}
const runBenchmark = require('../common/benchmark');

runBenchmark('napi',
[
'n=1',
'engine=v8',
'type=String'
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('napi', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
11 changes: 1 addition & 10 deletions test/benchmark/test-benchmark-net.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('net',
[
'dur=0',
'len=1024',
'recvbufgenfn=false',
'recvbuflen=0',
'sendchunklen=256',
'type=buf'
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('net', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
2 changes: 1 addition & 1 deletion test/benchmark/test-benchmark-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('os', ['n=1']);
runBenchmark('os');
9 changes: 1 addition & 8 deletions test/benchmark/test-benchmark-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('path',
[
'n=1',
'path=',
'pathext=',
'paths=',
'props='
], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('path', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
7 changes: 1 addition & 6 deletions test/benchmark/test-benchmark-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('process',
[
'n=1',
'type=raw',
'operation=enumerate',
], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('process', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
7 changes: 1 addition & 6 deletions test/benchmark/test-benchmark-querystring.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('querystring',
[ 'n=1',
'input="there is nothing to unescape here"',
'type=noencode'
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('querystring', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
11 changes: 1 addition & 10 deletions test/benchmark/test-benchmark-streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('streams',
[
'kind=duplex',
'n=1',
'sync=no',
'writev=no',
'callback=no',
'type=buffer',
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('streams', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
5 changes: 1 addition & 4 deletions test/benchmark/test-benchmark-string_decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('string_decoder', ['chunkLen=16',
'encoding=utf8',
'inLen=32',
'n=1']);
runBenchmark('string_decoder');
8 changes: 1 addition & 7 deletions test/benchmark/test-benchmark-timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@ require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('timers',
[
'direction=start',
'n=1',
'type=depth',
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
runBenchmark('timers', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
14 changes: 1 addition & 13 deletions test/benchmark/test-benchmark-tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,4 @@ if (!common.enoughTestMem)

const runBenchmark = require('../common/benchmark');

runBenchmark('tls',
[
'concurrency=1',
'dur=0.1',
'n=1',
'size=2',
'securing=SecurePair',
'type=asc'
],
{
NODEJS_BENCHMARK_ZERO_ALLOWED: 1,
duration: 0
});
runBenchmark('tls', { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });
Loading

0 comments on commit 78aa348

Please sign in to comment.