diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-08-18 21:29:59 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-08-25 12:03:57 +0200 |
commit | 1aa9d3a2ab9bcd03f58efc95dc0077a82088fe61 (patch) | |
tree | 8e530e87b1f9e6e94d2249644f752f105304a140 | |
parent | f9539c19e8cae4069fe97da616b8894f21ef83ae (diff) | |
download | node-new-1aa9d3a2ab9bcd03f58efc95dc0077a82088fe61.tar.gz |
build: make ci test addons in test/addons
Make `make test-addons` part of the `make test-ci` target.
Use order-only prerequisites to make generating and building the add-ons
concurrency-safe when $JOBS > 1 and fudge the dependency on $(NODE_EXE)
so that add-ons are only rebuilt when needed instead of all the time.
PR-URL: https://github.com/nodejs/node/pull/2428
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rod Vagg <rod@vagg.org>
-rw-r--r-- | Makefile | 41 | ||||
-rw-r--r-- | test/addons/.gitignore | 2 |
2 files changed, 33 insertions, 10 deletions
@@ -99,19 +99,39 @@ test/gc/node_modules/weak/build/Release/weakref.node: $(NODE_EXE) --directory="$(shell pwd)/test/gc/node_modules/weak" \ --nodedir="$(shell pwd)" -build-addons: $(NODE_EXE) - rm -rf test/addons/doc-*/ +# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale. +test/addons/.docbuildstamp: doc/api/addons.markdown + $(RM) -r test/addons/doc-*/ $(NODE) tools/doc/addon-verify.js - $(foreach dir, \ - $(sort $(dir $(wildcard test/addons/*/*.gyp))), \ - $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ - --directory="$(shell pwd)/$(dir)" \ - --nodedir="$(shell pwd)" && ) echo "build done" + touch $@ + +ADDONS_BINDING_GYPS := \ + $(filter-out test/addons/doc-*/binding.gyp, \ + $(wildcard test/addons/*/binding.gyp)) + +# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale. +test/addons/.buildstamp: $(ADDONS_BINDING_GYPS) | test/addons/.docbuildstamp + # Cannot use $(wildcard test/addons/*/) here, it's evaluated before + # embedded addons have been generated from the documentation. + for dirname in test/addons/*/; do \ + $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ + --directory="$$PWD/$$dirname" \ + --nodedir="$$PWD"; \ + done + touch $@ + +# .buildstamp and .docbuildstamp need $(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 and .docbuildstamp are 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: $(NODE_EXE) test/addons/.buildstamp test-gc: all test/gc/node_modules/weak/build/Release/weakref.node $(PYTHON) tools/test.py --mode=release gc -test-build: all build-addons +test-build: | all build-addons test-all: test-build test/gc/node_modules/weak/build/Release/weakref.node $(PYTHON) tools/test.py --mode=debug,release @@ -119,8 +139,9 @@ test-all: test-build test/gc/node_modules/weak/build/Release/weakref.node test-all-valgrind: test-build $(PYTHON) tools/test.py --mode=debug,release --valgrind -test-ci: - $(PYTHON) tools/test.py -p tap --logfile test.tap --mode=release message parallel sequential +test-ci: | build-addons + $(PYTHON) tools/test.py -p tap --logfile test.tap --mode=release \ + addons message parallel sequential test-release: test-build $(PYTHON) tools/test.py --mode=release diff --git a/test/addons/.gitignore b/test/addons/.gitignore index ff6b007943..bde1cf3ab9 100644 --- a/test/addons/.gitignore +++ b/test/addons/.gitignore @@ -1,3 +1,5 @@ +.buildstamp +.docbuildstamp Makefile *.Makefile *.mk |