summaryrefslogtreecommitdiff
path: root/test/sequential/test-benchmark-http.js
blob: fb0c1390c545e2e5fe4d574347aac0e68c200ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';

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

if (!common.enoughTestMem)
  common.skip('Insufficient memory for HTTP benchmark test');

// Minimal test for http benchmarks. This makes sure the benchmarks aren't
// horribly broken but nothing more than that.

// Because the http 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.

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', 'benchmarker=test-double',
                           '--set', 'c=1',
                           '--set', 'chunkedEnc=true',
                           '--set', 'chunks=0',
                           '--set', 'dur=0.1',
                           '--set', 'key=""',
                           '--set', 'len=1',
                           '--set', 'method=write',
                           '--set', 'n=1',
                           '--set', 'res=normal',
                           'http'],
                   {env});
child.on('exit', (code, signal) => {
  assert.strictEqual(code, 0);
  assert.strictEqual(signal, null);
});