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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
3ec8cec648
commit
8c99a224d2
10
Makefile
10
Makefile
@ -270,7 +270,7 @@ v8:
|
|||||||
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
|
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
|
||||||
|
|
||||||
.PHONY: jstest
|
.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) \
|
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
|
||||||
--skip-tests=$(CI_SKIP_TESTS) \
|
--skip-tests=$(CI_SKIP_TESTS) \
|
||||||
$(CI_JS_SUITES) \
|
$(CI_JS_SUITES) \
|
||||||
@ -414,7 +414,7 @@ clear-stalled:
|
|||||||
echo $${PS_OUT} | xargs kill -9; \
|
echo $${PS_OUT} | xargs kill -9; \
|
||||||
fi
|
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
|
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
|
test-ci-js: | clear-stalled
|
||||||
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
|
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
|
||||||
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
|
--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."
|
@echo "Clean up any leftover processes, error if found."
|
||||||
ps awwx | grep Release/node | grep -v grep | cat
|
ps awwx | grep Release/node | grep -v grep | cat
|
||||||
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
|
@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
|
.PHONY: test-ci
|
||||||
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
|
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
|
||||||
test-ci: LOGLEVEL := info
|
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
|
out/Release/cctest --gtest_output=tap:cctest.tap
|
||||||
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
|
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
|
||||||
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
|
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
|
||||||
@ -496,7 +496,7 @@ test-debug: test-build
|
|||||||
test-message: test-build
|
test-message: test-build
|
||||||
$(PYTHON) tools/test.py $(PARALLEL_ARGS) message
|
$(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
|
$(PYTHON) tools/test.py $(PARALLEL_ARGS) parallel sequential
|
||||||
|
|
||||||
test-pummel: all
|
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);
|
status = napi_get_array_length(env, array, &length);
|
||||||
assert(status == napi_ok);
|
assert(status == napi_ok);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < length; ++i) {
|
uint32_t i;
|
||||||
|
for (i = 0; i < length; ++i) {
|
||||||
napi_value v;
|
napi_value v;
|
||||||
status = napi_get_element(env, array, i, &v);
|
status = napi_get_element(env, array, i, &v);
|
||||||
assert(status == napi_ok);
|
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);
|
status = napi_get_value_uint32(env, args[0], &loop);
|
||||||
assert(status == napi_ok);
|
assert(status == napi_ok);
|
||||||
|
|
||||||
for (uint32_t i = 1; i < loop; ++i) {
|
uint32_t i;
|
||||||
|
for (i = 1; i < loop; ++i) {
|
||||||
assert(i < argc);
|
assert(i < argc);
|
||||||
status = napi_typeof(env, args[i], types);
|
status = napi_typeof(env, args[i], types);
|
||||||
assert(status == napi_ok);
|
assert(status == napi_ok);
|
||||||
|
24
test/sequential/test-benchmark-napi.js
Normal file
24
test/sequential/test-benchmark-napi.js
Normal file
@ -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 });
|
Loading…
x
Reference in New Issue
Block a user