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).
On my configuration, I have the node source on a NTFS partition (dual-boot Windows), and I want to avoid the tests on the chmod
to fail (the chmod is partition-wide and set when mounting). This PR allows to run the tests using a different tmpdir without having to move the node source to the same mount point.
NODE_TEST_DIR=/tmp/ make test -j4
Ref: http://man7.org/linux/man-pages/man2/rename.2.html
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines