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-js-native-api-tests build-node-api-tests  # # 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 )  \ 
@@ -281,21 +281,24 @@ jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
281281test : all # # Runs default tests, linters, and builds docs.
282282	$(MAKE )  -s test-doc
283283	$(MAKE )  -s build-addons
284- 	$(MAKE )  -s build-addons-napi
284+ 	$(MAKE )  -s build-js-native-api-tests
285+ 	$(MAKE )  -s build-node-api-tests
285286	$(MAKE )  -s cctest
286287	$(MAKE )  -s jstest
287288
288289.PHONY : test-only
289290test-only : all  # # For a quick test, does not run linter or build docs.
290291	$(MAKE )  build-addons
291- 	$(MAKE )  build-addons-napi
292+ 	$(MAKE )  build-js-native-api-tests
293+ 	$(MAKE )  build-node-api-tests
292294	$(MAKE )  cctest
293295	$(MAKE )  jstest
294296
295297#  Used by `make coverage-test`
296298test-cov : all
297299	$(MAKE )  build-addons
298- 	$(MAKE )  build-addons-napi
300+ 	$(MAKE )  build-js-native-api-tests
301+ 	$(MAKE )  build-node-api-tests
299302	#  $(MAKE) cctest
300303	CI_SKIP_TESTS=core_line_numbers.js $(MAKE )  jstest
301304
@@ -381,30 +384,55 @@ test/addons/.buildstamp: $(ADDONS_PREREQS) \
381384#  TODO(bnoordhuis) Force rebuild after gyp update.
382385build-addons : | $(NODE_EXE )  test/addons/.buildstamp
383386
384- ADDONS_NAPI_BINDING_GYPS  := \ 
385- 	$(filter-out  test/addons-napi /??_* /binding.gyp, \ 
386- 		$(wildcard  test/addons-napi /* /binding.gyp) ) 
387+ JS_NATIVE_API_BINDING_GYPS  := \ 
388+ 	$(filter-out  test/js-native-api /??_* /binding.gyp, \ 
389+ 		$(wildcard  test/js-native-api /* /binding.gyp) ) 
387390
388- ADDONS_NAPI_BINDING_SOURCES  := \ 
389- 	$(filter-out  test/addons-napi /??_* /* .c, $(wildcard  test/addons-napi /* /* .c) )  \ 
390- 	$(filter-out  test/addons-napi /??_* /* .cc, $(wildcard  test/addons-napi /* /* .cc) )  \ 
391- 	$(filter-out  test/addons-napi /??_* /* .h, $(wildcard  test/addons-napi /* /* .h) ) 
391+ JS_NATIVE_API_BINDING_SOURCES  := \ 
392+ 	$(filter-out  test/js-native-api /??_* /* .c, $(wildcard  test/js-native-api /* /* .c) )  \ 
393+ 	$(filter-out  test/js-native-api /??_* /* .cc, $(wildcard  test/js-native-api /* /* .cc) )  \ 
394+ 	$(filter-out  test/js-native-api /??_* /* .h, $(wildcard  test/js-native-api /* /* .h) ) 
392395
393- #  Implicitly depends on $(NODE_EXE), see the build-addons-napi  rule for rationale.
394- test/addons-napi /.buildstamp : $(ADDONS_PREREQS )  \ 
395- 	$(ADDONS_NAPI_BINDING_GYPS )  $(ADDONS_NAPI_BINDING_SOURCES )  \ 
396+ #  Implicitly depends on $(NODE_EXE), see the build-js-native-api-tests  rule for rationale.
397+ test/js-native-api /.buildstamp : $(ADDONS_PREREQS )  \ 
398+ 	$(JS_NATIVE_API_BINDING_GYPS )  $(JS_NATIVE_API_BINDING_SOURCES )  \ 
396399	src/node_api.h src/node_api_types.h src/js_native_api.h \ 
397400	src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h
398- 	@$(call  run_build_addons,"$$PWD/test/addons-napi ",$@ ) 
401+ 	@$(call  run_build_addons,"$$PWD/test/js-native-api ",$@ ) 
399402
400- .PHONY : build-addons-napi 
403+ .PHONY : build-js-native-api-tests 
401404#  .buildstamp needs $(NODE_EXE) but cannot depend on it
402405#  directly because it calls make recursively.  The parent make cannot know
403406#  if the subprocess touched anything so it pessimistically assumes that
404407#  .buildstamp is out of date and need a rebuild.
405408#  Just goes to show that recursive make really is harmful...
406409#  TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
407- build-addons-napi : | $(NODE_EXE )  test/addons-napi/.buildstamp
410+ build-js-native-api-tests : | $(NODE_EXE )  test/js-native-api/.buildstamp
411+ 
412+ NODE_API_BINDING_GYPS  := \ 
413+ 	$(filter-out  test/node-api/??_* /binding.gyp, \ 
414+ 		$(wildcard  test/node-api/* /binding.gyp) ) 
415+ 
416+ NODE_API_BINDING_SOURCES  := \ 
417+ 	$(filter-out  test/node-api/??_* /* .c, $(wildcard  test/node-api/* /* .c) )  \ 
418+ 	$(filter-out  test/node-api/??_* /* .cc, $(wildcard  test/node-api/* /* .cc) )  \ 
419+ 	$(filter-out  test/node-api/??_* /* .h, $(wildcard  test/node-api/* /* .h) ) 
420+ 
421+ #  Implicitly depends on $(NODE_EXE), see the build-node-api-tests rule for rationale.
422+ test/node-api/.buildstamp : $(ADDONS_PREREQS )  \ 
423+ 	$(NODE_API_BINDING_GYPS )  $(NODE_API_BINDING_SOURCES )  \ 
424+ 	src/node_api.h src/node_api_types.h src/js_native_api.h \ 
425+ 	src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h
426+ 	@$(call  run_build_addons,"$$PWD/test/node-api",$@ ) 
427+ 
428+ .PHONY : build-node-api-tests
429+ #  .buildstamp needs $(NODE_EXE) but cannot depend on it
430+ #  directly because it calls make recursively.  The parent make cannot know
431+ #  if the subprocess touched anything so it pessimistically assumes that
432+ #  .buildstamp is out of date and need a rebuild.
433+ #  Just goes to show that recursive make really is harmful...
434+ #  TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
435+ build-node-api-tests : | $(NODE_EXE )  test/node-api/.buildstamp
408436
409437.PHONY : clear-stalled
410438clear-stalled :
@@ -415,9 +443,11 @@ clear-stalled:
415443		echo  $$ {PS_OUT} |  xargs kill  -9;  \ 
416444	fi 
417445
418- test-build : | all build-addons build-addons-napi 
446+ test-build : | all build-addons build-js-native-api-tests build-node-api-tests 
419447
420- test-build-addons-napi : all build-addons-napi
448+ test-build-js-native-api : all build-js-native-api-tests
449+ 
450+ test-build-node-api : all build-node-api-tests
421451
422452.PHONY : test-all
423453test-all : test-build # # Run everything in test/.
@@ -426,15 +456,15 @@ test-all: test-build ## Run everything in test/.
426456test-all-valgrind : test-build
427457	$(PYTHON )  tools/test.py $(PARALLEL_ARGS )  --mode=debug,release --valgrind
428458
429- CI_NATIVE_SUITES  ?= addons addons-napi 
459+ CI_NATIVE_SUITES  ?= addons js-native-api node-api 
430460CI_JS_SUITES  ?= default
431461CI_DOC  := doctool
432462
433463.PHONY : test-ci-native
434464#  Build and test addons without building anything else
435465#  Related CI job: node-test-commit-arm-fanned
436466test-ci-native : LOGLEVEL := info
437- test-ci-native : | test/addons/.buildstamp test/addons-napi /.buildstamp
467+ test-ci-native : | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api /.buildstamp
438468	$(PYTHON )  tools/test.py $(PARALLEL_ARGS )  -p tap --logfile test.tap \ 
439469		--mode=$(BUILDTYPE_LOWER )  --flaky-tests=$(FLAKY_TESTS )  \ 
440470		$(TEST_CI_ARGS )  $(CI_NATIVE_SUITES ) 
@@ -456,7 +486,7 @@ test-ci-js: | clear-stalled
456486.PHONY : test-ci
457487#  Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
458488test-ci : LOGLEVEL := info
459- test-ci : | clear-stalled build-addons build-addons-napi  doc-only
489+ test-ci : | clear-stalled build-addons build-js-native-api-tests build-node-api-tests  doc-only
460490	out/Release/cctest --gtest_output=tap:cctest.tap
461491	$(PYTHON )  tools/test.py $(PARALLEL_ARGS )  -p tap --logfile test.tap \ 
462492		--mode=$(BUILDTYPE_LOWER )  --flaky-tests=$(FLAKY_TESTS )  \ 
@@ -539,32 +569,43 @@ test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm.
539569test-npm-publish : $(NODE_EXE ) 
540570	npm_package_config_publishtest=true $(NODE )  deps/npm/test/run.js
541571
542- .PHONY : test-addons-napi
543- test-addons-napi : test-build-addons-napi
544- 	$(PYTHON )  tools/test.py $(PARALLEL_ARGS )  --mode=$(BUILDTYPE_LOWER )  addons-napi
572+ .PHONY : test-js-native-api
573+ test-js-native-api : test-build-js-native-api
574+ 	$(PYTHON )  tools/test.py $(PARALLEL_ARGS )  --mode=$(BUILDTYPE_LOWER )  js-native-api
575+ 
576+ .PHONY : test-js-native-api-clean
577+ test-js-native-api-clean :
578+ 	$(RM )  -r test/js-native-api/* /build
579+ 	$(RM )  test/js-native-api/.buildstamp
580+ 
581+ .PHONY : test-node-api
582+ test-node-api : test-build-node-api
583+ 	$(PYTHON )  tools/test.py $(PARALLEL_ARGS )  --mode=$(BUILDTYPE_LOWER )  node-api
545584
546- .PHONY : test-addons-napi -clean
547- test-addons-napi -clean :
548- 	$(RM )  -r test/addons-napi /* /build
549- 	$(RM )  test/addons-napi /.buildstamp
585+ .PHONY : test-node-api -clean
586+ test-node-api -clean :
587+ 	$(RM )  -r test/node-api /* /build
588+ 	$(RM )  test/node-api /.buildstamp
550589
551590.PHONY : test-addons
552- test-addons : test-build test-addons-napi 
591+ test-addons : test-build test-js-native-api test-node-api 
553592	$(PYTHON )  tools/test.py $(PARALLEL_ARGS )  --mode=$(BUILDTYPE_LOWER )  addons
554593
555594.PHONY : test-addons-clean
556595test-addons-clean :
557596	$(RM )  -r test/addons/?? _* /
558597	$(RM )  -r test/addons/* /build
559598	$(RM )  test/addons/.buildstamp test/addons/.docbuildstamp
560- 	$(MAKE )  test-addons-napi-clean
599+ 	$(MAKE )  test-js-native-api-clean
600+ 	$(MAKE )  test-node-api-clean
561601
562602test-async-hooks :
563603	$(PYTHON )  tools/test.py $(PARALLEL_ARGS )  --mode=$(BUILDTYPE_LOWER )  async-hooks
564604
565605test-with-async-hooks :
566606	$(MAKE )  build-addons
567- 	$(MAKE )  build-addons-napi
607+ 	$(MAKE )  build-js-native-api-tests
608+ 	$(MAKE )  build-node-api-tests
568609	$(MAKE )  cctest
569610	NODE_TEST_WITH_ASYNC_HOOKS=1 $(PYTHON )  tools/test.py $(PARALLEL_ARGS )  --mode=$(BUILDTYPE_LOWER )  \ 
570611		$(CI_JS_SUITES )  \ 
@@ -1136,7 +1177,7 @@ LINT_CPP_ADDON_DOC_FILES = $(wildcard $(LINT_CPP_ADDON_DOC_FILES_GLOB))
11361177LINT_CPP_EXCLUDE  ?=
11371178LINT_CPP_EXCLUDE  += src/node_root_certs.h
11381179LINT_CPP_EXCLUDE  += $(LINT_CPP_ADDON_DOC_FILES ) 
1139- LINT_CPP_EXCLUDE  += $(wildcard  test/addons-napi /??_* /* .cc test/addons-napi /??_* /* .h) 
1180+ LINT_CPP_EXCLUDE  += $(wildcard  test/js-native-api /??_* /* .cc test/js-native-api/??_ * / * .h test/node-api/??_ * / * .cc test/node-api /??_* /* .h) 
11401181#  These files were copied more or less verbatim from V8.
11411182LINT_CPP_EXCLUDE  += src/tracing/trace_event.h src/tracing/trace_event_common.h
11421183
@@ -1152,8 +1193,10 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
11521193	test/addons/* /* .h \ 
11531194	test/cctest/* .cc \ 
11541195	test/cctest/* .h \ 
1155- 	test/addons-napi/* /* .cc \ 
1156- 	test/addons-napi/* /* .h \ 
1196+ 	test/js-native-api/* /* .cc \ 
1197+ 	test/js-native-api/* /* .h \ 
1198+ 	test/node-api/* /* .cc \ 
1199+ 	test/node-api/* /* .h \ 
11571200	tools/icu/* .cc \ 
11581201	tools/icu/* .h \ 
11591202	) )
0 commit comments