Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: rebuild test addons conditionally #335

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ distclean:
-rm -rf node_modules
-rm -rf deps/icu
-rm -rf deps/icu4c*.tgz deps/icu4c*.zip deps/icu-tmp
-rm -rf test/addons/doc-*/

test: all
$(PYTHON) tools/test.py --mode=release message parallel sequential -J
Expand All @@ -108,14 +109,33 @@ 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-*/
./$(NODE_EXE) tools/doc/addon-verify.js
$(foreach dir, \
$(sort $(dir $(wildcard test/addons/*/*.gyp))), \
./$(NODE_EXE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
--directory="$(shell pwd)/$(dir)" \
--nodedir="$(shell pwd)" && ) echo "build done"
ADDONS_TESTS = \
async-hello-world \
at-exit \
hello-world-function-export \
hello-world \
repl-domain-abort \

# Note: don't depend on $(NODE_EXE) here, that unconditionally forces a rebuild.
test/addons/%/build/Release/binding.node: \
test/addons/%/binding.cc test/addons/%/binding.gyp
./$(NODE_EXE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
--nodedir="$(PWD)" --directory="$(dir $<)"

build-static-addons: \
$(NODE_EXE) $(ADDONS_TESTS:%=test/addons/%/build/Release/binding.node)

# Note: don't depend on $(NODE_EXE) here, that unconditionally forces a rebuild.
test/addons/.stamp: tools/doc/addon-verify.js doc/api/addons.markdown
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't look like addon-verify is run, so those doc tests won't be built?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Which I'm fine with for now, by the by, I'm not a huge fan of doctests.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, perhaps I made it too obtuse for the sake of DRY. In the line below, $< is replaced with tools/doc/addon-verify.js.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still breaks on OSX for me on first run -- running ./$(NODE_EXE) addon-verify.js in a separate target to create the test/addon/doc-* dirs that the test/addons/.stamp target depends on should fix this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! That's the problem -- it evaluates and expands $(foreach dir... before executing addon-verify.js -- and thus it can't see those new directories, and the test fails because node-gyp hasn't run in those dirs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is a make issue... I see what you are saying but I can only reproduce it on OS X with make 3.81. On Linux with make 4.0, it always builds things in the right order, no matter how many jobs I throw at it. Will investigate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't reproduce it on OS X anymore either, I wonder what changed... @chrisdickinson Can you give it one more try? If it still fails for you, can you tell me how to reproduce?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reproduce you have to rm -rf test/addons/doc-* between test runs.

On Jan 16, 2015, at 4:04 AM, Ben Noordhuis notifications@github.com wrote:

In Makefile:

  • at-exit \
  • hello-world-function-export \
  • hello-world \
  • repl-domain-abort \

+# Note: don't depend on $(NODE_EXE) here, that unconditionally forces a rebuild.
+test/addons/%/build/Release/binding.node: \

  •   test/addons/%/binding.cc test/addons/%/binding.gyp
    
  • ./$(NODE_EXE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
  •   --nodedir="$(PWD)" --directory="$(dir $<)"
    
    +build-static-addons: \
  • $(NODE_EXE) $(ADDONS_TESTS:%=test/addons/%/build/Release/binding.node)

+# Note: don't depend on $(NODE_EXE) here, that unconditionally forces a rebuild.
+test/addons/.stamp: tools/doc/addon-verify.js doc/api/addons.markdown
I can't reproduce it on OS X anymore either, I wonder what changed... @chrisdickinson Can you give it one more try? If it still fails for you, can you tell me how to reproduce?


Reply to this email directly or view it on GitHub.

./$(NODE_EXE) $<
$(foreach dir, $(dir $(wildcard test/addons/doc-*/*.gyp)), \
./$(NODE_EXE) deps/npm/node_modules/node-gyp/bin/node-gyp \
rebuild --nodedir="$(PWD)" --directory="$(dir)")
touch $@

build-doc-addons: $(NODE_EXE) test/addons/.stamp

build-addons: build-doc-addons build-static-addons

test-gc: all test/gc/node_modules/weak/build/Release/weakref.node
$(PYTHON) tools/test.py --mode=release gc
Expand Down Expand Up @@ -171,7 +191,7 @@ test-npm-publish: $(NODE_EXE)
npm_package_config_publishtest=true ./$(NODE_EXE) deps/npm/test/run.js

test-addons: test-build
$(PYTHON) tools/test.py --mode=release addons
$(PYTHON) tools/test.py -J addons

test-timers:
$(MAKE) --directory=tools faketime
Expand Down
1 change: 1 addition & 0 deletions test/addons/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.stamp
Makefile
*.Makefile
*.mk
Expand Down