summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2019-08-12 10:38:30 +0200
committerRich Trott <rtrott@gmail.com>2019-08-14 15:52:20 -0700
commitf7321dc7f950bb8027a589ca86e0f650b8301661 (patch)
tree18c9a22d32653d6178a8dc50d99fa4772d6a0cd0
parenta352a7129e380c518d9676c55389adae10e9017d (diff)
downloadandroid-node-v8-f7321dc7f950bb8027a589ca86e0f650b8301661.tar.gz
android-node-v8-f7321dc7f950bb8027a589ca86e0f650b8301661.tar.bz2
android-node-v8-f7321dc7f950bb8027a589ca86e0f650b8301661.zip
test: skip test-fs-access if root
Currently, if this test is run as the root user the following failure will occur: === release test-fs-access === Path: parallel/test-fs-access (node:46733) internal/test/binding: These APIs are for internal testing only. Do not use them. Can't clean tmpdir: /root/node/test/.tmp.522 Files blocking: [ 'read_only_file', 'read_write_file' ] /root/node/test/common/tmpdir.js:136 throw e; ^ Error: EACCES: permission denied, rmdir '/root/node/test/.tmp.522' at Object.rmdirSync (fs.js:693:3) at rmdirSync (/root/node/test/common/tmpdir.js:72:8) at rimrafSync (/root/node/test/common/tmpdir.js:41:7) at process.onexit (/root/node/test/common/tmpdir.js:121:5) at process.emit (events.js:214:15) { errno: -13, syscall: 'rmdir', code: 'EACCES', path: '/root/node/test/.tmp.522' } Command: ./node --expose-internals test/parallel/test-fs-access.js This commit adds a root user check and skips this test if running as the user root. PR-URL: https://github.com/nodejs/node/pull/29092 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
-rw-r--r--test/parallel/test-fs-access.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/parallel/test-fs-access.js b/test/parallel/test-fs-access.js
index d0f730f25e..a4057dcb83 100644
--- a/test/parallel/test-fs-access.js
+++ b/test/parallel/test-fs-access.js
@@ -5,6 +5,9 @@
// and the errors thrown from these APIs include the desired properties
const common = require('../common');
+if (!common.isWindows && process.getuid() === 0)
+ common.skip('as this test should not be run as `root`');
+
const assert = require('assert');
const fs = require('fs');
const path = require('path');