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

test: set umask for tests #25229

Closed
wants to merge 2 commits into from
Closed

test: set umask for tests #25229

wants to merge 2 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Dec 26, 2018

#25213 proposes setting umask in the
Python test runner to avoid spurious test failures when running from a
shell with a restrictive umask. This is a good idea, but will only fix
the issue for tests run with the Python runner. Set it in
common/index.js as well so that it fixes it even when tests are run
directly with a node binary, bypassing the Python test runner.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 26, 2018
@Trott
Copy link
Member Author

Trott commented Dec 26, 2018

Before:

$ umask 077 && ./node test/parallel/test-fs-mkdir-mode-mask.js 
assert.js:86
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

384 !== 420

    at test (/Users/trott/io.js/test/parallel/test-fs-mkdir-mode-mask.js:32:12)
    at Object.<anonymous> (/Users/trott/io.js/test/parallel/test-fs-mkdir-mode-mask.js:44:1)
    at Module._compile (internal/modules/cjs/loader.js:718:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:729:10)
    at Module.load (internal/modules/cjs/loader.js:617:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:771:12)
    at executeUserCode (internal/bootstrap/node.js:389:15)
    at startExecution (internal/bootstrap/node.js:328:3)
$ 

After:

$ umask 077 && ./node test/parallel/test-fs-mkdir-mode-mask.js 
$ 

@Trott
Copy link
Member Author

Trott commented Dec 26, 2018

@Trott Trott added the wip Issues and PRs that are still a work in progress. label Dec 26, 2018
@lpinca
Copy link
Member

lpinca commented Dec 26, 2018

Lot of failures.

@Trott
Copy link
Member Author

Trott commented Dec 26, 2018

Lot of failures.

Yes, I added the WIP label because it needs to account for situations (mostly or entirely worker_threads in our tests) where process.umask() is not available.

@Trott
Copy link
Member Author

Trott commented Dec 26, 2018

Yes, I added the WIP label because it needs to account for situations (mostly or entirely worker_threads in our tests) where process.umask() is not available.

It's probably as simple as checking for existence first and doing nothing if it's not there (and assuming a parent process took care of it) but I want to check carefully to make sure there's nothing that requires anything more than that.

nodejs#25213 proposes setting umask in the
Python test runner to avoid spurious test failures when running from a
shell with a restrictive umask. This is a good idea, but will only fix
the issue for tests run with the Python runner. Set it in
`common/index.js` as well so that it fixes it even when tests are run
directly with a `node` binary, bypassing the Python test runner.
@Trott Trott removed the wip Issues and PRs that are still a work in progress. label Jan 9, 2019
@Trott
Copy link
Member Author

Trott commented Jan 9, 2019

@Trott
Copy link
Member Author

Trott commented Jan 9, 2019

@Trott
Copy link
Member Author

Trott commented Jan 10, 2019

Landed in a53518d

@Trott Trott closed this Jan 10, 2019
Trott added a commit to Trott/io.js that referenced this pull request Jan 10, 2019
nodejs#25213 proposes setting umask in the
Python test runner to avoid spurious test failures when running from a
shell with a restrictive umask. This is a good idea, but will only fix
the issue for tests run with the Python runner. Set it in
`common/index.js` as well so that it fixes it even when tests are run
directly with a `node` binary, bypassing the Python test runner.

PR-URL: nodejs#25229
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax pushed a commit that referenced this pull request Jan 14, 2019
#25213 proposes setting umask in the
Python test runner to avoid spurious test failures when running from a
shell with a restrictive umask. This is a good idea, but will only fix
the issue for tests run with the Python runner. Set it in
`common/index.js` as well so that it fixes it even when tests are run
directly with a `node` binary, bypassing the Python test runner.

PR-URL: #25229
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Jan 16, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
nodejs#25213 proposes setting umask in the
Python test runner to avoid spurious test failures when running from a
shell with a restrictive umask. This is a good idea, but will only fix
the issue for tests run with the Python runner. Set it in
`common/index.js` as well so that it fixes it even when tests are run
directly with a `node` binary, bypassing the Python test runner.

PR-URL: nodejs#25229
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2019
@Trott Trott deleted the tmpdir-umask branch January 13, 2022 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants