Skip to content

Commit

Permalink
test: set umask for tests
Browse files Browse the repository at this point in the history
#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 <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott committed Jan 10, 2019
1 parent 8c0290e commit a53518d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ const {
hasIntl
} = process.binding('config');

// Some tests assume a umask of 0o022 so set that up front. Tests that need a
// different umask will set it themselves.
//
// process.umask() is not available in workers so we need to check for its
// existence.
if (process.umask)
process.umask(0o022);

const noop = () => {};

const hasCrypto = Boolean(process.versions.openssl);
Expand Down

0 comments on commit a53518d

Please sign in to comment.