summaryrefslogtreecommitdiff
path: root/test/common/index.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2018-12-26 06:14:54 -0800
committerRich Trott <rtrott@gmail.com>2019-01-09 19:09:09 -0800
commita53518d027c7ab72e66100fa32a1d5a9898ca6d0 (patch)
treefa10fe086d49f67e97e6b1e4fb82daa3a9f568c3 /test/common/index.js
parent8c0290e0543af85ac82c243987d5996c00a16cc6 (diff)
downloadandroid-node-v8-a53518d027c7ab72e66100fa32a1d5a9898ca6d0.tar.gz
android-node-v8-a53518d027c7ab72e66100fa32a1d5a9898ca6d0.tar.bz2
android-node-v8-a53518d027c7ab72e66100fa32a1d5a9898ca6d0.zip
test: set umask for tests
https://github.com/nodejs/node/pull/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: https://github.com/nodejs/node/pull/25229 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/common/index.js')
-rw-r--r--test/common/index.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/common/index.js b/test/common/index.js
index ea59009ba5..eff5f47e89 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -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);