Skip to content
Permalink
Browse files

test: add test-benchmark-napi

Also makes sure that the napi benchmark is built before running jstest.

Skipped on windows since n-api benchmarks aren't built there yet.

PR-URL: #23585
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
forivall authored and MylesBorins committed Oct 12, 2018
1 parent cb861a4 commit 55ca2a71fd92643faa66708b0985a0289ed067a7
Showing with 33 additions and 7 deletions.
  1. +5 −5 Makefile
  2. +4 −2 benchmark/napi/function_args/napi_binding.c
  3. +24 −0 test/sequential/test-benchmark-napi.js
@@ -270,7 +270,7 @@ v8:
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)

.PHONY: jstest
jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
jstest: build-addons build-addons-napi bench-addons-build ## Runs addon tests and JS tests
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
--skip-tests=$(CI_SKIP_TESTS) \
$(CI_JS_SUITES) \
@@ -414,7 +414,7 @@ clear-stalled:
echo $${PS_OUT} | xargs kill -9; \
fi

test-build: | all build-addons build-addons-napi
test-build: | all build-addons build-addons-napi bench-addons-build

test-build-addons-napi: all build-addons-napi

@@ -444,7 +444,7 @@ test-ci-native: | test/addons/.buildstamp test/addons-napi/.buildstamp
test-ci-js: | clear-stalled
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) $(CI_JS_SUITES)
$(TEST_CI_ARGS) $(CI_JS_SUITES) --skip-tests=sequential/test-benchmark-napi
@echo "Clean up any leftover processes, error if found."
ps awwx | grep Release/node | grep -v grep | cat
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
@@ -455,7 +455,7 @@ test-ci-js: | clear-stalled
.PHONY: test-ci
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
test-ci: LOGLEVEL := info
test-ci: | clear-stalled build-addons build-addons-napi doc-only
test-ci: | clear-stalled build-addons build-addons-napi doc-only bench-addons-build
out/Release/cctest --gtest_output=tap:cctest.tap
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
@@ -496,7 +496,7 @@ test-debug: test-build
test-message: test-build
$(PYTHON) tools/test.py $(PARALLEL_ARGS) message

test-simple: | cctest # Depends on 'all'.
test-simple: | cctest bench-addons-build # Depends on 'all'.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) parallel sequential

test-pummel: all
@@ -50,7 +50,8 @@ static napi_value CallWithArray(napi_env env, napi_callback_info info) {
status = napi_get_array_length(env, array, &length);
assert(status == napi_ok);

for (uint32_t i = 0; i < length; ++i) {
uint32_t i;
for (i = 0; i < length; ++i) {
napi_value v;
status = napi_get_element(env, array, i, &v);
assert(status == napi_ok);
@@ -173,7 +174,8 @@ static napi_value CallWithArguments(napi_env env, napi_callback_info info) {
status = napi_get_value_uint32(env, args[0], &loop);
assert(status == napi_ok);

for (uint32_t i = 1; i < loop; ++i) {
uint32_t i;
for (i = 1; i < loop; ++i) {
assert(i < argc);
status = napi_typeof(env, args[i], types);
assert(status == napi_ok);
@@ -0,0 +1,24 @@
'use strict';

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

if (common.isWindows) {
common.skip('vcbuild.bat doesn\'t build the n-api benchmarks yet');
}

if (!common.isMainThread) {
common.skip('addons are not supported in workers');
}

if (process.features.debug) {
common.skip('benchmark does not work with debug build yet');
}
const runBenchmark = require('../common/benchmark');

runBenchmark('napi',
[
'n=1',
'engine=v8',
'type=String'
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });

0 comments on commit 55ca2a7

Please sign in to comment.
You can’t perform that action at this time.