diff options
author | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2018-11-17 12:34:54 -0800 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2018-12-04 13:58:17 -0800 |
commit | 938e11882b96e19b443477571455088baaa054d8 (patch) | |
tree | eb828a60957a2881995ba9a83f44a32a18fbff16 /Makefile | |
parent | 83ee137c4565112177f22f2c735b266b22262220 (diff) | |
download | android-node-v8-938e11882b96e19b443477571455088baaa054d8.tar.gz android-node-v8-938e11882b96e19b443477571455088baaa054d8.tar.bz2 android-node-v8-938e11882b96e19b443477571455088baaa054d8.zip |
test: partition N-API tests
Partition test/addons-napi into test/js-native-api and test/node-api to
isolate the Node.js-agnostic portion of the N-API tests from the
Node.js-specific portion.
PR-URL: https://github.com/nodejs/node/pull/24557
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 113 |
1 files changed, 78 insertions, 35 deletions
@@ -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-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ --skip-tests=$(CI_SKIP_TESTS) \ $(CI_JS_SUITES) \ @@ -281,21 +281,24 @@ jstest: build-addons build-addons-napi ## Runs addon tests and JS tests test: all ## Runs default tests, linters, and builds docs. $(MAKE) -s test-doc $(MAKE) -s build-addons - $(MAKE) -s build-addons-napi + $(MAKE) -s build-js-native-api-tests + $(MAKE) -s build-node-api-tests $(MAKE) -s cctest $(MAKE) -s jstest .PHONY: test-only test-only: all ## For a quick test, does not run linter or build docs. $(MAKE) build-addons - $(MAKE) build-addons-napi + $(MAKE) build-js-native-api-tests + $(MAKE) build-node-api-tests $(MAKE) cctest $(MAKE) jstest # Used by `make coverage-test` test-cov: all $(MAKE) build-addons - $(MAKE) build-addons-napi + $(MAKE) build-js-native-api-tests + $(MAKE) build-node-api-tests # $(MAKE) cctest CI_SKIP_TESTS=core_line_numbers.js $(MAKE) jstest @@ -381,30 +384,55 @@ test/addons/.buildstamp: $(ADDONS_PREREQS) \ # TODO(bnoordhuis) Force rebuild after gyp update. build-addons: | $(NODE_EXE) test/addons/.buildstamp -ADDONS_NAPI_BINDING_GYPS := \ - $(filter-out test/addons-napi/??_*/binding.gyp, \ - $(wildcard test/addons-napi/*/binding.gyp)) +JS_NATIVE_API_BINDING_GYPS := \ + $(filter-out test/js-native-api/??_*/binding.gyp, \ + $(wildcard test/js-native-api/*/binding.gyp)) -ADDONS_NAPI_BINDING_SOURCES := \ - $(filter-out test/addons-napi/??_*/*.c, $(wildcard test/addons-napi/*/*.c)) \ - $(filter-out test/addons-napi/??_*/*.cc, $(wildcard test/addons-napi/*/*.cc)) \ - $(filter-out test/addons-napi/??_*/*.h, $(wildcard test/addons-napi/*/*.h)) +JS_NATIVE_API_BINDING_SOURCES := \ + $(filter-out test/js-native-api/??_*/*.c, $(wildcard test/js-native-api/*/*.c)) \ + $(filter-out test/js-native-api/??_*/*.cc, $(wildcard test/js-native-api/*/*.cc)) \ + $(filter-out test/js-native-api/??_*/*.h, $(wildcard test/js-native-api/*/*.h)) -# Implicitly depends on $(NODE_EXE), see the build-addons-napi rule for rationale. -test/addons-napi/.buildstamp: $(ADDONS_PREREQS) \ - $(ADDONS_NAPI_BINDING_GYPS) $(ADDONS_NAPI_BINDING_SOURCES) \ +# Implicitly depends on $(NODE_EXE), see the build-js-native-api-tests rule for rationale. +test/js-native-api/.buildstamp: $(ADDONS_PREREQS) \ + $(JS_NATIVE_API_BINDING_GYPS) $(JS_NATIVE_API_BINDING_SOURCES) \ src/node_api.h src/node_api_types.h src/js_native_api.h \ src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h - @$(call run_build_addons,"$$PWD/test/addons-napi",$@) + @$(call run_build_addons,"$$PWD/test/js-native-api",$@) -.PHONY: build-addons-napi +.PHONY: build-js-native-api-tests # .buildstamp needs $(NODE_EXE) but cannot depend on it # directly because it calls make recursively. The parent make cannot know # if the subprocess touched anything so it pessimistically assumes that # .buildstamp is out of date and need a rebuild. # Just goes to show that recursive make really is harmful... # TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. -build-addons-napi: | $(NODE_EXE) test/addons-napi/.buildstamp +build-js-native-api-tests: | $(NODE_EXE) test/js-native-api/.buildstamp + +NODE_API_BINDING_GYPS := \ + $(filter-out test/node-api/??_*/binding.gyp, \ + $(wildcard test/node-api/*/binding.gyp)) + +NODE_API_BINDING_SOURCES := \ + $(filter-out test/node-api/??_*/*.c, $(wildcard test/node-api/*/*.c)) \ + $(filter-out test/node-api/??_*/*.cc, $(wildcard test/node-api/*/*.cc)) \ + $(filter-out test/node-api/??_*/*.h, $(wildcard test/node-api/*/*.h)) + +# Implicitly depends on $(NODE_EXE), see the build-node-api-tests rule for rationale. +test/node-api/.buildstamp: $(ADDONS_PREREQS) \ + $(NODE_API_BINDING_GYPS) $(NODE_API_BINDING_SOURCES) \ + src/node_api.h src/node_api_types.h src/js_native_api.h \ + src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h + @$(call run_build_addons,"$$PWD/test/node-api",$@) + +.PHONY: build-node-api-tests +# .buildstamp needs $(NODE_EXE) but cannot depend on it +# directly because it calls make recursively. The parent make cannot know +# if the subprocess touched anything so it pessimistically assumes that +# .buildstamp is out of date and need a rebuild. +# Just goes to show that recursive make really is harmful... +# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. +build-node-api-tests: | $(NODE_EXE) test/node-api/.buildstamp .PHONY: clear-stalled clear-stalled: @@ -415,9 +443,11 @@ clear-stalled: echo $${PS_OUT} | xargs kill -9; \ fi -test-build: | all build-addons build-addons-napi +test-build: | all build-addons build-js-native-api-tests build-node-api-tests -test-build-addons-napi: all build-addons-napi +test-build-js-native-api: all build-js-native-api-tests + +test-build-node-api: all build-node-api-tests .PHONY: test-all test-all: test-build ## Run everything in test/. @@ -426,7 +456,7 @@ test-all: test-build ## Run everything in test/. test-all-valgrind: test-build $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release --valgrind -CI_NATIVE_SUITES ?= addons addons-napi +CI_NATIVE_SUITES ?= addons js-native-api node-api CI_JS_SUITES ?= default CI_DOC := doctool @@ -434,7 +464,7 @@ CI_DOC := doctool # Build and test addons without building anything else # Related CI job: node-test-commit-arm-fanned test-ci-native: LOGLEVEL := info -test-ci-native: | test/addons/.buildstamp test/addons-napi/.buildstamp +test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ $(TEST_CI_ARGS) $(CI_NATIVE_SUITES) @@ -456,7 +486,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-js-native-api-tests build-node-api-tests doc-only 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) \ @@ -539,17 +569,26 @@ test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm. test-npm-publish: $(NODE_EXE) npm_package_config_publishtest=true $(NODE) deps/npm/test/run.js -.PHONY: test-addons-napi -test-addons-napi: test-build-addons-napi - $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons-napi +.PHONY: test-js-native-api +test-js-native-api: test-build-js-native-api + $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) js-native-api + +.PHONY: test-js-native-api-clean +test-js-native-api-clean: + $(RM) -r test/js-native-api/*/build + $(RM) test/js-native-api/.buildstamp + +.PHONY: test-node-api +test-node-api: test-build-node-api + $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) node-api -.PHONY: test-addons-napi-clean -test-addons-napi-clean: - $(RM) -r test/addons-napi/*/build - $(RM) test/addons-napi/.buildstamp +.PHONY: test-node-api-clean +test-node-api-clean: + $(RM) -r test/node-api/*/build + $(RM) test/node-api/.buildstamp .PHONY: test-addons -test-addons: test-build test-addons-napi +test-addons: test-build test-js-native-api test-node-api $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons .PHONY: test-addons-clean @@ -557,14 +596,16 @@ test-addons-clean: $(RM) -r test/addons/??_*/ $(RM) -r test/addons/*/build $(RM) test/addons/.buildstamp test/addons/.docbuildstamp - $(MAKE) test-addons-napi-clean + $(MAKE) test-js-native-api-clean + $(MAKE) test-node-api-clean test-async-hooks: $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) async-hooks test-with-async-hooks: $(MAKE) build-addons - $(MAKE) build-addons-napi + $(MAKE) build-js-native-api-tests + $(MAKE) build-node-api-tests $(MAKE) cctest NODE_TEST_WITH_ASYNC_HOOKS=1 $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ $(CI_JS_SUITES) \ @@ -1136,7 +1177,7 @@ LINT_CPP_ADDON_DOC_FILES = $(wildcard $(LINT_CPP_ADDON_DOC_FILES_GLOB)) LINT_CPP_EXCLUDE ?= LINT_CPP_EXCLUDE += src/node_root_certs.h LINT_CPP_EXCLUDE += $(LINT_CPP_ADDON_DOC_FILES) -LINT_CPP_EXCLUDE += $(wildcard test/addons-napi/??_*/*.cc test/addons-napi/??_*/*.h) +LINT_CPP_EXCLUDE += $(wildcard test/js-native-api/??_*/*.cc test/js-native-api/??_*/*.h test/node-api/??_*/*.cc test/node-api/??_*/*.h) # These files were copied more or less verbatim from V8. LINT_CPP_EXCLUDE += src/tracing/trace_event.h src/tracing/trace_event_common.h @@ -1152,8 +1193,10 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \ test/addons/*/*.h \ test/cctest/*.cc \ test/cctest/*.h \ - test/addons-napi/*/*.cc \ - test/addons-napi/*/*.h \ + test/js-native-api/*/*.cc \ + test/js-native-api/*/*.h \ + test/node-api/*/*.cc \ + test/node-api/*/*.h \ tools/icu/*.cc \ tools/icu/*.h \ )) |