Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a80452a

Browse filesBrowse files
forivalltargos
authored andcommitted
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>
1 parent aaddf97 commit a80452a
Copy full SHA for a80452a

File tree

Expand file treeCollapse file tree

3 files changed

+33
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+33
-7
lines changed
Open diff view settings
Collapse file

‎Makefile‎

Copy file name to clipboardExpand all lines: Makefile
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ v8:
270270
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
271271

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

417-
test-build: | all build-addons build-addons-napi
417+
test-build: | all build-addons build-addons-napi bench-addons-build
418418

419419
test-build-addons-napi: all build-addons-napi
420420

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

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

502502
test-pummel: all
Collapse file

‎benchmark/napi/function_args/napi_binding.c‎

Copy file name to clipboardExpand all lines: benchmark/napi/function_args/napi_binding.c
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ static napi_value CallWithArray(napi_env env, napi_callback_info info) {
5050
status = napi_get_array_length(env, array, &length);
5151
assert(status == napi_ok);
5252

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

176-
for (uint32_t i = 1; i < loop; ++i) {
177+
uint32_t i;
178+
for (i = 1; i < loop; ++i) {
177179
assert(i < argc);
178180
status = napi_typeof(env, args[i], types);
179181
assert(status == napi_ok);
Collapse file
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
if (common.isWindows) {
6+
common.skip('vcbuild.bat doesn\'t build the n-api benchmarks yet');
7+
}
8+
9+
if (!common.isMainThread) {
10+
common.skip('addons are not supported in workers');
11+
}
12+
13+
if (process.features.debug) {
14+
common.skip('benchmark does not work with debug build yet');
15+
}
16+
const runBenchmark = require('../common/benchmark');
17+
18+
runBenchmark('napi',
19+
[
20+
'n=1',
21+
'engine=v8',
22+
'type=String'
23+
],
24+
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.