Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v13.11.0 proposal #32185

Merged
merged 108 commits into from Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
31e4a0d
src: Handle bad callback in asyc_wrap
HarshithaKP Feb 25, 2020
89987b3
test: remove common.expectsInternalAssertion
Trott Feb 29, 2020
83e9a3e
test: add coverage for FSWatcher exception
Trott Mar 1, 2020
a727b13
crypto: make update(buf, enc) ignore encoding
bnoordhuis Feb 13, 2020
4ac1ce1
src: introduce node_sockaddr
jasnell Mar 3, 2020
5f12595
doc: update email address in authors
yaelhe Feb 29, 2020
c0ba6ec
meta: move thefourtheye to TSC Emeritus
Trott Mar 3, 2020
31ec443
benchmark: remove problematic tls params
mscdex Feb 16, 2020
50094de
doc: remove em dashes
Trott Mar 4, 2020
a037770
src,http2: introduce node_http_common
jasnell Mar 3, 2020
3befe80
async_hooks: fix ctx loss after nested ALS calls
puzpuzpuz Mar 4, 2020
2585b81
stream: add comments to pipeline implementation
ronag Mar 2, 2020
55486bc
events: fix removeListener for Symbols
fuxingZhang Feb 18, 2020
1ffa9f3
http: fix socket re-use races
ronag Feb 28, 2020
8e43568
test: update tests for larger Buffers
jakobkummerow Jan 20, 2020
7c739aa
build: enable backtrace when V8 is built for PPC and S390x
targos Oct 29, 2019
dd83bd2
wasi: add returnOnExit option
cjihrig Mar 5, 2020
74edcc5
test: apply camelCase in test-net-reconnect-error
Trott Mar 6, 2020
da7349d
test: remove superfluous checks in test-net-reconnect-error
Trott Mar 6, 2020
2e5f81f
doc: fix broken links in benchmark README
Trott Mar 6, 2020
1428de8
test: add WASI test for path_link()
cjihrig Mar 6, 2020
a79b8fa
doc: document fs.watchFile() bigint option
cjihrig Mar 6, 2020
7b9b578
src: fix -Winconsistent-missing-override warning
cjihrig Mar 6, 2020
e9f9d07
src: fix -Wreorder compiler warning
cjihrig Mar 6, 2020
97965f5
doc: document self-referencing a package name
giltayar Feb 7, 2020
c106a85
fs: fix valid id range on chown, lchown, fchown
himself65 Feb 9, 2020
bd75688
src: add missing namespace using statements in node_watchdog.h
legendecas Mar 6, 2020
296f35b
src: improve KVStore API
lundibundi Feb 13, 2020
cc27846
src: simplify node_worker.cc using new KVStore API
lundibundi Feb 13, 2020
6545d1a
test: allow EAI_FAIL in test-net-dns-error.js
Feb 13, 2020
50c5eb4
doc: link setRawMode() from signal docs
addaleax Mar 4, 2020
f07d423
build: allow passing multiple libs to pkg_config
andred Mar 2, 2020
6413524
build: allow use of system-installed brotli
andred Mar 2, 2020
3d64c9e
test: changed function to arrow function
ProdipRoy89 Mar 2, 2020
862cd2b
test: use index.js if package.json "main" is empty
bnoordhuis Mar 2, 2020
cba75c5
src: handle NULL env scenario
HarshithaKP Feb 21, 2020
6a9654a
test: increase test timeout to prevent flakiness
BridgeAR Feb 10, 2020
02ebc81
doc: revise tools/icu/README.md
Trott Mar 7, 2020
4d5981b
async_hooks: add sync enterWith to ALS
Qard Feb 25, 2020
710c905
n-api: define release 6
Mar 3, 2020
6f9f2c5
test: warn when inspector process crashes
mmarchini Mar 7, 2020
e1347b4
cli: allow --jitless V8 flag in NODE_OPTIONS
andrewdotn Mar 4, 2020
e11f38c
benchmark: refactor helper into a class
BridgeAR Feb 12, 2020
5d92cec
benchmark: add `test` and `all` options and improve errors"
BridgeAR Feb 12, 2020
92cc406
test: refactor all benchmark tests to use the new test option
BridgeAR Feb 12, 2020
ddb8824
benchmark: remove special test entries
BridgeAR Feb 12, 2020
4640ea2
stream: don't destroy final readable stream in pipeline
ronag Mar 5, 2020
90a4d43
stream: combine properties using defineProperties
antsmartian Feb 10, 2020
1e05ddf
stream: improve writable.write() performance
mscdex Feb 3, 2020
1c4f4cc
fs: fix writeFile[Sync] for non-seekable files
mildsunrise Feb 28, 2020
9d1b1a3
stream: simplify Writable.write
ronag Dec 31, 2019
7ce1cc9
stream: simplify pipeline
ronag Jan 18, 2020
4b04bf8
stream: re-use legacy destroyer
ronag Jan 21, 2020
f263659
stream: eos make const state const
ronag Mar 1, 2020
258a80d
src: create a getter for kernel version
juanarbol Mar 10, 2020
2388a40
src: make aliased_buffer.h self-contained
joyeecheung Feb 20, 2020
5127c70
src: refactor debug category parsing
joyeecheung Feb 20, 2020
6aa797b
src: implement per-process native Debug() printer
joyeecheung Feb 20, 2020
bb41383
tools: use per-process native Debug() printer in mkcodecache
joyeecheung Feb 20, 2020
188f1d2
test: improve test-debug-usage
Trott Mar 8, 2020
2d39369
doc: remove personal pronoun usage in addons.md
Trott Mar 8, 2020
fa99fb2
doc: remove personal pronoun usage in errors.md
Trott Mar 8, 2020
618b389
doc: remove personal pronoun usage in fs.md
Trott Mar 8, 2020
7de4dfb
doc: remove personal pronoun usage in policy.md
Trott Mar 8, 2020
1e9a251
src: use C++ style for struct with initializers
sam-github Mar 7, 2020
3c06316
build: workaround for gclient python3 issues
mmarchini Mar 7, 2020
bc1e357
doc: change worker.takeHeapSnapshot to getHeapSnapshot
Flarna Mar 3, 2020
4589863
test: always skip vm-timeout-escape-queuemicrotask
lundibundi Feb 27, 2020
eaf6723
vm: refactor value validation with internal/validators.js
lundibundi Jan 23, 2020
607ac90
lib: improve value validation utils
lundibundi Jan 23, 2020
ff58854
fs: return first folder made by mkdir recursive
bcoe Jan 29, 2020
897b1d2
lib: move isLegalPort to validators, refactor
jasnell Feb 18, 2020
7eed9d6
fs: fix WriteStream autoClose order
ronag Feb 14, 2020
84197ea
test: mark test-timers-blocking-callback flaky on osx
MylesBorins Mar 11, 2020
55a8ca8
src: elevate v8 namespace
RamanandPatil Mar 2, 2020
0a00552
stream: do not swallow errors with async iterators and pipeline
mcollina Mar 2, 2020
625d8f7
src: discard tasks posted to platform TaskRunner during shutdown
addaleax Feb 18, 2020
d8c927b
Revert "src: keep main-thread Isolate attached to platform during Dis…
addaleax Feb 18, 2020
c70cfd2
tools: update ESLint to 7.0.0-alpha.0
cjihrig Feb 28, 2020
cac1d01
tools: update ESLint to 7.0.0-alpha.1
cjihrig Feb 28, 2020
814bb4a
tools: update ESLint to 7.0.0-alpha.2
cjihrig Feb 28, 2020
d3c4210
tools: enable default-case-last lint rule
cjihrig Feb 28, 2020
35d0569
tools: enable no-useless-backreference lint rule
cjihrig Feb 28, 2020
94f3eed
fs: make fs.read params optional
lholmquist Jan 16, 2020
d66daa5
build: support android build on ndk version equal or above 23
forfun414 Jan 26, 2020
c3aa3e7
src: remove unused include from node_file.cc
bnoordhuis Feb 15, 2020
fa376f4
src: fix -Wmaybe-uninitialized compiler warning
bnoordhuis Feb 15, 2020
38329bd
doc: prevent tables from shrinking page
davidgilbertson Feb 18, 2020
3fa57ee
doc: add entry for `AsyncHook` class
HarshithaKP Feb 19, 2020
ceca1c3
test: improve test-fs-existssync-false.js
himself65 Feb 20, 2020
35bea07
doc: add support encoding link on string_decoder.md
himself65 Feb 22, 2020
5bc5161
doc: improve Buffer documentation
addaleax Mar 4, 2020
49a07f7
http, async_hooks: remove unneeded reference to wrapping resource
Flarna Mar 2, 2020
2248ba7
src: fix missing extra ca in tls.rootCertificates
ebickle Mar 3, 2020
fa78aa4
doc: clarify windows specific behaviour
sam-github Mar 4, 2020
af73ed6
doc: clear up child_process command resolution
lundibundi Mar 4, 2020
fe34da8
build: add mjs extension to lint-js
nschonni Mar 8, 2020
4c2e4d1
esm: remove unused parameter on module.instantiate
himself65 Mar 8, 2020
893e918
doc: include the error type in the request.resolve doc
trusktr Mar 8, 2020
478f1e7
async_hooks: avoid resource reuse by FileHandle
Flarna Feb 18, 2020
079bb31
build: remove empty line on node.gyp file
juanarbol Feb 25, 2020
025f658
src: fix spawnSync CHECK when SIGKILL fails
bnoordhuis Feb 13, 2020
ce686c0
crypto: optimize sign.update() and verify.update()
bnoordhuis Feb 13, 2020
e83671c
src: DRY crypto Update() methods
bnoordhuis Feb 13, 2020
77e5b50
doc,test: add server.timeout property to http2 public API
puzpuzpuz Feb 8, 2020
66fe2d9
stream: avoid destroying http1 objects
ronag Mar 11, 2020
fab8c83
stream: avoid destroying writable source
ronag Mar 11, 2020
4a53612
2020-03-11 Version 13.11.0 (Current)
MylesBorins Mar 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintrc.js
Expand Up @@ -85,6 +85,7 @@ module.exports = {
'comma-style': 'error',
'computed-property-spacing': 'error',
'constructor-super': 'error',
'default-case-last': 'error',
'dot-location': ['error', 'property'],
'dot-notation': 'error',
'eol-last': 'error',
Expand Down Expand Up @@ -273,6 +274,7 @@ module.exports = {
functions: false,
variables: false,
}],
'no-useless-backreference': 'error',
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-concat': 'error',
Expand Down
1 change: 1 addition & 0 deletions .mailmap
Expand Up @@ -423,6 +423,7 @@ Wilson Lin <wla80@sfu.ca>
Wyatt Preul <wpreul@gmail.com> geek <wpreul@gmail.com>
Xavier J Ortiz <xavier.ortiz.ch@gmail.com>
xiaoyu <306766053@qq.com> Poker <306766053@qq.com>
Yael Hermon <yaelherm@gmail.com> <yaelhe@wix.com>
Yazhong Liu <yorkiefixer@gmail.com> Yazhong Liu <l900422@vip.qq.com>
Yazhong Liu <yorkiefixer@gmail.com> Yorkie <l900422@vip.qq.com>
Yazhong Liu <yorkiefixer@gmail.com> Yorkie <yorkiefixer@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS
Expand Up @@ -2636,7 +2636,7 @@ Charles Samborski <demurgos@demurgos.net>
zhmushan <zhmushan@qq.com>
yoshimoto koki <yoyoyo427435@gmail.com>
Ilarion Halushka <hilarion.galushka@gmail.com>
Yael Hermon <yaelhe@wix.com>
Yael Hermon <yaelherm@gmail.com>
Mitch Hankins <mitchhankins92@gmail.com>
Mikko Rantanen <jubjub@jubjubnest.net>
wenjun ye <1728914873@qq.com>
Expand Down
29 changes: 15 additions & 14 deletions CHANGELOG.md
Expand Up @@ -2,19 +2,19 @@

Select a Node.js version below to view the changelog history:

* [Node.js 13](doc/changelogs/CHANGELOG_V13.md) - **Current**
* [Node.js 12](doc/changelogs/CHANGELOG_V12.md) - **Long Term Support**
* [Node.js 11](doc/changelogs/CHANGELOG_V11.md) - End-of-Life
* [Node.js 10](doc/changelogs/CHANGELOG_V10.md) Long Term Support
* [Node.js 9](doc/changelogs/CHANGELOG_V9.md) End-of-Life
* [Node.js 8](doc/changelogs/CHANGELOG_V8.md) — Long Term Support
* [Node.js 7](doc/changelogs/CHANGELOG_V7.md) End-of-Life
* [Node.js 6](doc/changelogs/CHANGELOG_V6.md) End-of-Life
* [Node.js 5](doc/changelogs/CHANGELOG_V5.md) End-of-Life
* [Node.js 4](doc/changelogs/CHANGELOG_V4.md) End-of-Life
* [io.js](doc/changelogs/CHANGELOG_IOJS.md) End-of-Life
* [Node.js 0.12](doc/changelogs/CHANGELOG_V012.md) End-of-Life
* [Node.js 0.10](doc/changelogs/CHANGELOG_V010.md) End-of-Life
* [Node.js 13](doc/changelogs/CHANGELOG_V13.md) **Current**
* [Node.js 12](doc/changelogs/CHANGELOG_V12.md) **Long Term Support**
* [Node.js 11](doc/changelogs/CHANGELOG_V11.md) End-of-Life
* [Node.js 10](doc/changelogs/CHANGELOG_V10.md) Long Term Support
* [Node.js 9](doc/changelogs/CHANGELOG_V9.md) End-of-Life
* [Node.js 8](doc/changelogs/CHANGELOG_V8.md) End-of-Life
* [Node.js 7](doc/changelogs/CHANGELOG_V7.md) End-of-Life
* [Node.js 6](doc/changelogs/CHANGELOG_V6.md) End-of-Life
* [Node.js 5](doc/changelogs/CHANGELOG_V5.md) End-of-Life
* [Node.js 4](doc/changelogs/CHANGELOG_V4.md) End-of-Life
* [io.js](doc/changelogs/CHANGELOG_IOJS.md) End-of-Life
* [Node.js 0.12](doc/changelogs/CHANGELOG_V012.md) End-of-Life
* [Node.js 0.10](doc/changelogs/CHANGELOG_V010.md) End-of-Life
* [Archive](doc/changelogs/CHANGELOG_ARCHIVE.md)

Please use the following table to find the changelog for a specific Node.js
Expand All @@ -30,7 +30,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V13.md#13.10.1">13.10.1</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V13.md#13.11.0">13.11.0</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V13.md#13.10.1">13.10.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V13.md#13.10.0">13.10.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V13.md#13.9.0">13.9.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V13.md#13.8.0">13.8.0</a><br/>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -181,8 +181,6 @@ For information about the governance of the Node.js project, see
**Sam Roberts** &lt;vieuxtech@gmail.com&gt;
* [targos](https://github.com/targos) -
**Michaël Zasso** &lt;targos@protonmail.com&gt; (he/him)
* [thefourtheye](https://github.com/thefourtheye) -
**Sakthipriyan Vairamani** &lt;thechargingvolcano@gmail.com&gt; (he/him)
* [tniessen](https://github.com/tniessen) -
**Tobias Nießen** &lt;tniessen@tnie.de&gt;
* [Trott](https://github.com/Trott) -
Expand Down Expand Up @@ -222,6 +220,8 @@ For information about the governance of the Node.js project, see
**Rod Vagg** &lt;r@va.gg&gt;
* [shigeki](https://github.com/shigeki) -
**Shigeki Ohtsu** &lt;ohtsu@ohtsu.org&gt; (he/him)
* [thefourtheye](https://github.com/thefourtheye) -
**Sakthipriyan Vairamani** &lt;thechargingvolcano@gmail.com&gt; (he/him)
* [TimothyGu](https://github.com/TimothyGu) -
**Tiancheng "Timothy" Gu** &lt;timothygu99@gmail.com&gt; (he/him)
* [trevnorris](https://github.com/trevnorris) -
Expand Down
78 changes: 42 additions & 36 deletions android-configure
Expand Up @@ -8,72 +8,78 @@
# modules with npm. Also, don't forget to set the arch in npm config using
# 'npm config set arch=<arch>'

if [ $# -ne 3 ]; then
echo "$0 should have 3 parameters: ndk_path, target_arch and sdk_version"
exit 1
fi

NDK_PATH=$1
ARCH="$2"
ANDROID_SDK_VERSION=$3

if [ -z "$2" ]; then
ARCH=arm
else
ARCH="$2"
if [ $ANDROID_SDK_VERSION -lt 23 ]; then
echo "$ANDROID_SDK_VERSION should equal or later than 23(Android 6.0)"
fi

CC_VER="4.9"

case $ARCH in
arm)
DEST_CPU="$ARCH"
SUFFIX="$ARCH-linux-androideabi"
TOOLCHAIN_NAME="$SUFFIX"
DEST_CPU="arm"
TOOLCHAIN_NAME="armv7-linux-androideabi"
;;
x86)
DEST_CPU="ia32"
SUFFIX="i686-linux-android"
TOOLCHAIN_NAME="$ARCH"
TOOLCHAIN_NAME="i686-linux-android"
;;
x86_64)
DEST_CPU="ia32"
SUFFIX="$ARCH-linux-android"
TOOLCHAIN_NAME="$ARCH"
DEST_CPU="x64"
TOOLCHAIN_NAME="x86_64-linux-android"
ARCH="x64"
;;
arm64|aarch64)
DEST_CPU="arm64"
TOOLCHAIN_NAME="aarch64-linux-android"
ARCH="arm64"
;;
*)
echo "Unsupported architecture provided: $ARCH"
exit 1
;;
esac

NDK_PATH=$1
function make_toolchain {
$NDK_PATH/build/tools/make-standalone-toolchain.sh \
--toolchain=$TOOLCHAIN_NAME-$CC_VER \
--arch=$ARCH \
--install-dir=$TOOLCHAIN \
--platform=android-21
}
HOST_OS="linux"
HOST_ARCH="x86_64"
export CC_host=$(which gcc)
export CXX_host=$(which g++)

export TOOLCHAIN=$PWD/android-toolchain
if [ -d "$TOOLCHAIN" ]; then
read -r -p "NDK toolchain already exists. Replace it? [y/N]" response
case "$response" in
[Yy])
rm -rf "$TOOLCHAIN"
make_toolchain
esac
else
make_toolchain
host_gcc_version=$($CC_host --version | grep gcc | awk '{print $NF}')
major=$(echo $host_gcc_version | awk -F . '{print $1}')
minor=$(echo $host_gcc_version | awk -F . '{print $2}')
if [ -z $major ] || [ -z $minor ] || [ $major -lt 6 ] || [ $major -eq 6 -a $minor -lt 3 ]; then
echo "host gcc $host_gcc_version is too old, need gcc 6.3.0"
exit 1
fi

SUFFIX="$TOOLCHAIN_NAME$ANDROID_SDK_VERSION"
TOOLCHAIN=$NDK_PATH/toolchains/llvm/prebuilt/$HOST_OS-$HOST_ARCH

export PATH=$TOOLCHAIN/bin:$PATH
export AR=$TOOLCHAIN/bin/$SUFFIX-ar
export CC=$TOOLCHAIN/bin/$SUFFIX-gcc
export CXX=$TOOLCHAIN/bin/$SUFFIX-g++
export LINK=$TOOLCHAIN/bin/$SUFFIX-g++
export CC=$TOOLCHAIN/bin/$SUFFIX-clang
export CXX=$TOOLCHAIN/bin/$SUFFIX-clang++


GYP_DEFINES="target_arch=$ARCH"
GYP_DEFINES+=" v8_target_arch=$ARCH"
GYP_DEFINES+=" android_target_arch=$ARCH"
GYP_DEFINES+=" host_os=linux OS=android"
GYP_DEFINES+=" host_os=$HOST_OS OS=android"
export GYP_DEFINES

if [ -f "configure" ]; then
./configure \
--dest-cpu=$DEST_CPU \
--dest-os=android \
--without-snapshot \
--openssl-no-asm
--openssl-no-asm \
--cross-compiling
fi
6 changes: 3 additions & 3 deletions benchmark/README.md
Expand Up @@ -76,17 +76,17 @@ writing benchmarks.

### `createBenchmark(fn, configs[, options])`

See [the guide on writing benchmarks](../doc/guides/contributing/writing-and-running-benchmarks.md#basics-of-a-benchmark).
See [the guide on writing benchmarks](../doc/guides/writing-and-running-benchmarks.md#basics-of-a-benchmark).

### `default_http_benchmarker`

The default benchmarker used to run HTTP benchmarks.
See [the guide on writing HTTP benchmarks](../doc/guides/contributing/writing-and-running-benchmarks.md#creating-an-http-benchmark).
See [the guide on writing HTTP benchmarks](../doc/guides/writing-and-running-benchmarks.md#creating-an-http-benchmark).

### `PORT`

The default port used to run HTTP benchmarks.
See [the guide on writing HTTP benchmarks](../doc/guides/contributing/writing-and-running-benchmarks.md#creating-an-http-benchmark).
See [the guide on writing HTTP benchmarks](../doc/guides/writing-and-running-benchmarks.md#creating-an-http-benchmark).

### `sendResult(data)`

Expand Down
22 changes: 16 additions & 6 deletions benchmark/_cli.js
Expand Up @@ -6,22 +6,24 @@ const path = require('path');
// Create an object of all benchmark scripts
const benchmarks = {};
fs.readdirSync(__dirname)
.filter((name) => fs.statSync(path.resolve(__dirname, name)).isDirectory())
.filter((name) => {
return name !== 'fixtures' &&
fs.statSync(path.resolve(__dirname, name)).isDirectory();
})
.forEach((category) => {
benchmarks[category] = fs.readdirSync(path.resolve(__dirname, category))
.filter((filename) => filename[0] !== '.' && filename[0] !== '_');
});

function CLI(usage, settings) {
if (!(this instanceof CLI)) return new CLI(usage, settings);

if (process.argv.length < 3) {
this.abort(usage); // Abort will exit the process
}

this.usage = usage;
this.optional = {};
this.items = [];
this.test = false;

for (const argName of settings.arrayArgs) {
this.optional[argName] = [];
Expand All @@ -34,7 +36,7 @@ function CLI(usage, settings) {
if (arg === '--') {
// Only items can follow --
mode = 'item';
} else if ('both' === mode && arg[0] === '-') {
} else if (mode === 'both' && arg[0] === '-') {
// Optional arguments declaration

if (arg[1] === '-') {
Expand All @@ -61,6 +63,8 @@ function CLI(usage, settings) {

// The next value can be either an option or an item
mode = 'both';
} else if (arg === 'test') {
this.test = true;
} else if (['both', 'item'].includes(mode)) {
// item arguments
this.items.push(arg);
Expand All @@ -83,9 +87,15 @@ CLI.prototype.abort = function(msg) {
CLI.prototype.benchmarks = function() {
const paths = [];

if (this.items.includes('all')) {
this.items = Object.keys(benchmarks);
}

for (const category of this.items) {
if (benchmarks[category] === undefined)
continue;
if (benchmarks[category] === undefined) {
console.error(`The "${category}" category does not exist.`);
process.exit(1);
}
for (const scripts of benchmarks[category]) {
if (this.shouldSkip(scripts)) continue;

Expand Down
32 changes: 19 additions & 13 deletions benchmark/_http-benchmarkers.js
Expand Up @@ -43,9 +43,8 @@ class AutocannonBenchmarker {
}
if (!result || !result.requests || !result.requests.average) {
return undefined;
} else {
return result.requests.average;
}
return result.requests.average;
}
}

Expand All @@ -58,10 +57,13 @@ class WrkBenchmarker {
}

create(options) {
const duration = typeof options.duration === 'number' ?
Math.max(options.duration, 1) :
options.duration;
const args = [
'-d', options.duration,
'-d', duration,
'-c', options.connections,
'-t', 8,
'-t', Math.min(options.connections, require('os').cpus().length || 8),
`http://127.0.0.1:${options.port}${options.path}`,
];
for (const field in options.headers) {
Expand All @@ -77,9 +79,8 @@ class WrkBenchmarker {
const throughput = match && +match[1];
if (!isFinite(throughput)) {
return undefined;
} else {
return throughput;
}
return throughput;
}
}

Expand All @@ -89,18 +90,21 @@ class WrkBenchmarker {
*/
class TestDoubleBenchmarker {
constructor(type) {
// `type` is the type ofbenchmarker. Possible values are 'http' and 'http2'.
// `type` is the type of benchmarker. Possible values are 'http' and
// 'http2'.
this.name = `test-double-${type}`;
this.executable = path.resolve(__dirname, '_test-double-benchmarker.js');
this.present = fs.existsSync(this.executable);
this.type = type;
}

create(options) {
const env = Object.assign({
duration: options.duration,
process.env.duration = process.env.duration || options.duration || 5;

const env = {
test_url: `http://127.0.0.1:${options.port}${options.path}`,
}, process.env);
...process.env
};

const child = child_process.fork(this.executable,
[this.type],
Expand Down Expand Up @@ -189,13 +193,14 @@ http_benchmarkers.forEach((benchmarker) => {
});

exports.run = function(options, callback) {
options = Object.assign({
options = {
port: exports.PORT,
path: '/',
connections: 100,
duration: 5,
benchmarker: exports.default_http_benchmarker,
}, options);
...options
};
if (!options.benchmarker) {
callback(new Error('Could not locate required http benchmarker. See ' +
`${requirementsURL} for further instructions.`));
Expand All @@ -220,7 +225,8 @@ exports.run = function(options, callback) {
child.stderr.pipe(process.stderr);

let stdout = '';
child.stdout.on('data', (chunk) => stdout += chunk.toString());
child.stdout.setEncoding('utf8');
child.stdout.on('data', (chunk) => stdout += chunk);

child.once('close', (code) => {
const elapsed = process.hrtime(benchmarker_start);
Expand Down