-
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
test: make tests cwd-independent #12812
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nodejs-github-bot
added
doc
Issues and PRs related to the documentations.
test
Issues and PRs related to the tests.
tools
Issues and PRs related to the tools directory.
labels
May 3, 2017
aqrln
approved these changes
May 3, 2017
refack
approved these changes
May 4, 2017
cjihrig
approved these changes
May 4, 2017
Trott
approved these changes
May 4, 2017
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.
LGTM if CI is green.
It might be over-engineering, but perhaps a way to guard against this coming up with future tests would be to to have the common
module do a chdir()
to the expected directory. I'm not actually sure how I feel about that...
jasnell
approved these changes
May 4, 2017
addaleax
approved these changes
May 5, 2017
Landed in f1d593c |
addaleax
pushed a commit
that referenced
this pull request
May 5, 2017
PR-URL: #12812 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
anchnk
pushed a commit
to anchnk/node
that referenced
this pull request
May 6, 2017
PR-URL: nodejs#12812 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2 tasks
3 tasks
gibfahn
pushed a commit
that referenced
this pull request
Jun 18, 2017
PR-URL: #12812 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
gibfahn
pushed a commit
that referenced
this pull request
Jun 20, 2017
PR-URL: #12812 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins
pushed a commit
that referenced
this pull request
Jul 11, 2017
PR-URL: #12812 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test
Editing and checking various tests, I've sometimes stumbled on cases when tests failed depending on cwd. So I've run all the tests with this simple script to find out cwd-dependent tests. The script runs all tests from repo root (default test runner
tools/test.py
behavior) as well as from these ones:root/..
,root/test
,root/test/<test subdirectory>
. If a test fails in all cases or in no cases, it is loosely considered cwd-independent.So I've found out these 3 cwd-dependent tests:
parallel/test-process-chdir.js
can only be run outside of its directory (it makes too optimistic assumption thatprocess.cwd()
always!== __dirname
after test start).doctool/test-doctool-html.js
can only be run from the repo root.parallel/test-cli-eval.js
can only be run from the repo root. It tests some murky old regression bug in the critical fragment, so I've tried to be extra careful there.After this PR, these tests can be launched from any cwd.