Skip to content

Commit 2d3d4cc

Browse files
committed
test: add http benchmark test
PR-URL: #12121 Refs: #12068 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 3e3414f commit 2d3d4cc

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
if (!common.enoughTestMem) {
6+
common.skip('Insufficient memory for HTTP benchmark test');
7+
return;
8+
}
9+
10+
// Minimal test for http benchmarks. This makes sure the benchmarks aren't
11+
// horribly broken but nothing more than that.
12+
13+
// Because the http benchmarks use hardcoded ports, this should be in sequential
14+
// rather than parallel to make sure it does not conflict with tests that choose
15+
// random available ports.
16+
17+
const assert = require('assert');
18+
const fork = require('child_process').fork;
19+
const path = require('path');
20+
21+
const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js');
22+
23+
const child = fork(runjs, ['--set', 'dur=0.1',
24+
'--set', 'n=1',
25+
'--set', 'len=1',
26+
'--set', 'c=1',
27+
'--set', 'chunks=0',
28+
'--set', 'benchmarker=test-double',
29+
'http'],
30+
{env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}});
31+
child.on('exit', (code, signal) => {
32+
assert.strictEqual(code, 0);
33+
assert.strictEqual(signal, null);
34+
});

0 commit comments

Comments
 (0)