summaryrefslogtreecommitdiff
path: root/test/known_issues
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2017-04-11 14:26:36 -0400
committercjihrig <cjihrig@gmail.com>2017-04-18 13:44:48 -0400
commit4fc11998b4c3f90ba276cc573833e7a7322bbd15 (patch)
tree9c8f9858213571e42f4b80761e5a91499eb901a5 /test/known_issues
parent6331b63ce0e99bc1e5de4e21ea0c9da9df8ab759 (diff)
downloadandroid-node-v8-4fc11998b4c3f90ba276cc573833e7a7322bbd15.tar.gz
android-node-v8-4fc11998b4c3f90ba276cc573833e7a7322bbd15.tar.bz2
android-node-v8-4fc11998b4c3f90ba276cc573833e7a7322bbd15.zip
test: add cwd ENOENT known issue test
If the current working directory is removed, Node cannot start normally because the module system calls uv_cwd(). Refs: https://github.com/nodejs/node/pull/12022 PR-URL: https://github.com/nodejs/node/pull/12343 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/known_issues')
-rw-r--r--test/known_issues/test-cwd-enoent-file.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/known_issues/test-cwd-enoent-file.js b/test/known_issues/test-cwd-enoent-file.js
new file mode 100644
index 0000000000..3a5094eb39
--- /dev/null
+++ b/test/known_issues/test-cwd-enoent-file.js
@@ -0,0 +1,34 @@
+'use strict';
+// Refs: https://github.com/nodejs/node/pull/12022
+// If the cwd is deleted, Node cannot run files because the module system
+// relies on uv_cwd(). The -e and -p flags still work though.
+const common = require('../common');
+const assert = require('assert');
+
+if (common.isSunOS || common.isWindows || common.isAix) {
+ // The current working directory cannot be removed on these platforms.
+ // Change this to common.skip() when this is no longer a known issue test.
+ assert.fail('cannot rmdir current working directory');
+ return;
+}
+
+const cp = require('child_process');
+const fs = require('fs');
+
+if (process.argv[2] === 'child') {
+ // Do nothing.
+} else {
+ common.refreshTmpDir();
+ const dir = fs.mkdtempSync(common.tmpDir + '/');
+ process.chdir(dir);
+ fs.rmdirSync(dir);
+ assert.throws(process.cwd,
+ /^Error: ENOENT: no such file or directory, uv_cwd$/);
+
+ const r = cp.spawnSync(process.execPath, [__filename, 'child']);
+
+ assert.strictEqual(r.status, 0);
+ assert.strictEqual(r.signal, null);
+ assert.strictEqual(r.stdout.toString().trim(), '');
+ assert.strictEqual(r.stderr.toString().trim(), '');
+}