summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--benchmark/napi/function_args/napi_binding.c6
-rw-r--r--test/sequential/test-benchmark-napi.js24
3 files changed, 33 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index eeb65c38e0..dadc1e91ec 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/benchmark/napi/function_args/napi_binding.c b/benchmark/napi/function_args/napi_binding.c
index b697644ca4..1a3a0f1cd2 100644
--- a/benchmark/napi/function_args/napi_binding.c
+++ b/benchmark/napi/function_args/napi_binding.c
@@ -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);
diff --git a/test/sequential/test-benchmark-napi.js b/test/sequential/test-benchmark-napi.js
new file mode 100644
index 0000000000..1a1ff23d60
--- /dev/null
+++ b/test/sequential/test-benchmark-napi.js
@@ -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 });