Skip to content

Commit 0108ff6

Browse files
aduh95targos
authored andcommitted
test: add support for NODE_TEST_DIR on a separate mount point
Linux permits a filesystem to be mounted at multiple points, but `fs.renameSync` does not work across different mount points, even if the same filesystem is mounted on both. This fixes failing tests when NODE_TEST_DIR mount point is different from the one on which the tests are executed (E.G. on a separate partition). Ref: http://man7.org/linux/man-pages/man2/rename.2.html PR-URL: #21552 Refs: http://man7.org/linux/man-pages/man2/rename.2.html Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ben Coe <[email protected]>
1 parent d9825c7 commit 0108ff6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

test/parallel/test-fs-copyfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ try {
6464
} catch (err) {
6565
assert.strictEqual(err.syscall, 'copyfile');
6666
assert(err.code === 'ENOTSUP' || err.code === 'ENOTTY' ||
67-
err.code === 'ENOSYS');
67+
err.code === 'ENOSYS' || err.code === 'EXDEV');
6868
assert.strictEqual(err.path, src);
6969
assert.strictEqual(err.dest, dest);
7070
}

test/parallel/test-fs-error-messages.js

+5
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ function re(literals, ...values) {
303303
`ENOTEMPTY: directory not empty, rename '${existingDir}' -> ` +
304304
`'${existingDir2}'`);
305305
assert.strictEqual(err.errno, uv.UV_ENOTEMPTY);
306+
} else if (err.code === 'EXDEV') { // not on the same mounted filesystem
307+
assert.strictEqual(
308+
err.message,
309+
`EXDEV: cross-device link not permitted, rename '${existingDir}' -> ` +
310+
`'${existingDir2}'`);
306311
} else if (err.code === 'EEXIST') { // smartos and aix
307312
assert.strictEqual(
308313
err.message,

0 commit comments

Comments
 (0)