-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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,test: make building addon tests less fragile #17407
Conversation
Awesome, I'll get that CI stuff working post-haste
Can you elaborate? Is the point that if nothing has changed it doesn't still do a load of stuff? |
@@ -2227,3 +2234,10 @@ def CalculateMakefilePath(build_file, base_name): | |||
root_makefile.write(SHARED_FOOTER) | |||
|
|||
root_makefile.close() | |||
|
|||
# Hack to get rid of $(obj)/path/to/foo.o deps that node.gyp adds manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we float the gyp changes in a separate commit in case we lose them in a future gyp update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I'll split it out before landing.
Yep. Right now it always does this:
|
Makefile
Outdated
@@ -601,11 +530,8 @@ docopen: $(apidocs_html) | |||
docclean: | |||
$(RM) -r out/doc | |||
|
|||
build-ci: | |||
run-ci: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @nodejs/build in case there are any jobs directly running the build-ci
target.
Makefile
Outdated
$(NODE_G_EXE): out/Debug/node out/Makefile | ||
ln -fs $< $@ | ||
|
||
out/Release/node: $(ALL_DEPS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does $(ALL_DEPS)
include out/Makefile
? Since this target recursively executes make it should have a dependency on the makefile.
Makefile
Outdated
@@ -601,11 +530,8 @@ docopen: $(apidocs_html) | |||
docclean: | |||
$(RM) -r out/doc | |||
|
|||
build-ci: | |||
run-ci: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason the CI is complaining
+ make run-ci -j 2
make -C out BUILDTYPE=Release V=1
make[1]: *** out: No such file or directory. Stop.
Makefile:91: *** Missing or stale config.gypi, please run ./configure. Stop.
Build step 'Execute shell' marked build as failure
Ping @bnoordhuis This seems pretty nice but since the Makefile is a place where things change often, I hope we can get this done fast and land it. |
I don't recall saying I was going to look at this. I'm happy to, but the CI we were talking about was a build with cmake. CI fails as this needs a rebase. https://ci.nodejs.org/job/node-test-commit/14743/console |
266bb7e
to
3416edf
Compare
Rebased and I decided to check in the documentation add-ons. They don't change often enough to go through the trouble of generating them dynamically. Too race-y, too special.
|
fc07832
to
e496053
Compare
Glorious green! Please (re)review. The biggest change from the previous changeset:
|
Makefile
Outdated
deps/zlib/zlib.gyp deps/v8/gypfiles/toolchain.gypi \ | ||
deps/v8/gypfiles/features.gypi deps/v8/src/v8.gyp node.gyp \ | ||
config.gypi | ||
common.gypi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is config.gypi
intentionally dropped here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it's no longer necessary. I've pushed up a commit that restores it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take back what I wrote - it's still necessary because of the config.gypi: configure
rule below. But since it's correct to depend on config.gypi here, I'll just remove the other rule.
e496053
to
05ca6c7
Compare
@@ -1,3 +1,6 @@ | |||
<!-- | |||
Run `node tools/doc/addon-verify.js` when you change examples in this document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we could validate this? Maybe a test that contains the shasum of everything inside a js
code block in this file, that you have to update when it changes.
I guess tools/doc/addon-verify.js
would be the place to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a commit that adds a --check
flag to addon-verify.js and calls that from make test
.
05ca6c7
to
2151423
Compare
Makefile
Outdated
test: all ## Default test target. Runs default tests, linters, and builds docs. | ||
$(MAKE) -s build-addons | ||
$(MAKE) -s build-addons-napi | ||
check-doc-addons: $(NODE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be marked as phony.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
2151423
to
39931b4
Compare
With the -bash-4.2$ git clean -fdX
-bash-4.2$ make
make: *** No rule to make target `config.gypi', needed by `out/Makefile'. Stop.
-bash-4.2$ Is there a reason the makefile doesn't just run |
It used to and it was supremely annoying because it overwrote your settings. I removed it a few years ago. edit: to expand on that, you'd get situations like these:
|
Is there a reason we can't have the config.gypi rule with these changes? I'm a fan of the more helpful error message.
How about only generating a new config.gypi if there isn't one there already? |
Ensure `common.tmpDir` exists before trying to chdir into it. Fixes a "ENOENT: no such file or directory, uv_chdir" error when the temporary directory is removed before running the test. PR-URL: #17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Ensure `common.tmpDir` exists before trying to chdir into it. Fixes a "ENOENT: no such file or directory, uv_chdir" error when the temporary directory is removed before running the test. PR-URL: #17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Ensure `common.tmpDir` exists before trying to chdir into it. Fixes a "ENOENT: no such file or directory, uv_chdir" error when the temporary directory is removed before running the test. PR-URL: #17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Make GYP write a .deps file in the top-level directory that we can use in the Makefile to get a proper dependency chain for the `node` target. Preparatory work for getting rid of recursive make invocations. PR-URL: nodejs#17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Make the script synchronous and clean it up. This is preparatory work for follow-ups commits. PR-URL: nodejs#17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
* Get rid of recursive `make` when building the node binary. An earlier commit makes GYP write out rules that we can use for proper dependency tracking. * Use module name 'binding' in addons.md and addons-napi/*/binding.gyp. This massively simplifies the logic for generating the build rules. * Check in auto-generated add-on tests from `doc/api/addons.md`. The files change rarely and generating them dynamically causes no end of race conditions and special-casing during the build. PR-URL: nodejs#17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Add a `--check` flag to `tools/doc/addon-verify.js` and use that in the `make test` target to determine if the generated files in `test/addons` are fresh or stale. PR-URL: nodejs#17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Ensure `common.tmpDir` exists before trying to chdir into it. Fixes a "ENOENT: no such file or directory, uv_chdir" error when the temporary directory is removed before running the test. PR-URL: nodejs#17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This reverts commit 2cb9e2a. Reverted along with d9b59de as this introduces freshness checks that are too stringent without the comprehensive dependency checking of introduced in d9b59de so `make test` won't work with this. Ref: nodejs#17407 PR-URL: nodejs#18287 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This reverts commit d9b59de. Breaks downloadable source tarball builds as we remove some files prior to creating a tarball but those files are included in the comprehensive list of dependencies listed in .deps. Ref: nodejs#17407 PR-URL: nodejs#18287 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This reverts commit c668263. Reverted along with d9b59de as this breaks compilation from downloadable source tarballs. Ref: nodejs#17407 PR-URL: nodejs#18287 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This reverts commit 920c132. Reverted along with d9b59de as this breaks compilation from downloadable source tarballs. Ref: nodejs#17407 PR-URL: nodejs#18287 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
make
for building the node binaryThis is prep work for a dusted off and super-powered version of #12231.
make
finally works as intended now:And
make -j8 test
(finally!) builds add-ons in parallel.CI: https://ci.nodejs.org/job/node-test-pull-request/11830/CI: https://ci.nodejs.org/job/node-test-pull-request/11831/