From eb05e44b7a16f01992db5dfc589cf7e64a4a8b47 Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Mon, 25 Jan 2016 11:08:30 -0800 Subject: [PATCH] test: fs.link() test runs on same device When running the tests if `NODE_TEST_DIR` is set to a device different than the location of the test files (where this repo is checked out), then the parallel/test-fs-link.js test will fail with `EXDEV: cross-device link not permitted`. The code works fine (and is in fact throwing an error as desired) but the test fails. This commit first creates the "source" file in the same directory as the "destination" (where the hardlink will be created). PR-URL: https://github.com/nodejs/node/pull/4861 Reviewed-By: Ben Noordhuis Reviewed-By: Rich Trott --- test/parallel/test-fs-link.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-fs-link.js b/test/parallel/test-fs-link.js index 4e95d20f7b..8444ecea78 100644 --- a/test/parallel/test-fs-link.js +++ b/test/parallel/test-fs-link.js @@ -7,14 +7,14 @@ const fs = require('fs'); common.refreshTmpDir(); // test creating and reading hard link -const srcPath = path.join(common.fixturesDir, 'cycles', 'root.js'); +const srcPath = path.join(common.tmpDir, 'hardlink-target.txt'); const dstPath = path.join(common.tmpDir, 'link1.js'); +fs.writeFileSync(srcPath, 'hello world'); const callback = function(err) { if (err) throw err; - const srcContent = fs.readFileSync(srcPath, 'utf8'); const dstContent = fs.readFileSync(dstPath, 'utf8'); - assert.strictEqual(srcContent, dstContent); + assert.strictEqual('hello world', dstContent); }; fs.link(srcPath, dstPath, common.mustCall(callback));