test: use realpath for NODE_TEST_DIR in common.js

If you don't specify NODE_TEST_DIR, common.tmpDir will resolve to the
realpath of `node/test`.

If you do specify NODE_TEST_DIR (with the environment variable or by
running or by running tools/test.py --test-dir=x), common.tmpDir (which
is resolved from testRoot) uses the symbolic path (doesn't resolve
symlinks). This uses fs.realpathSync() to fix that.

PR-URL: https://github.com/nodejs/node/pull/10723
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
Gibson Fahnestock
2017-01-10 13:43:08 +00:00
committed by Myles Borins
parent 626875f2e4
commit 9abde3ac6e

View File

@@ -9,7 +9,7 @@ const stream = require('stream');
const util = require('util');
const testRoot = process.env.NODE_TEST_DIR ?
path.resolve(process.env.NODE_TEST_DIR) : __dirname;
fs.realpathSync(process.env.NODE_TEST_DIR) : __dirname;
exports.testDir = __dirname;
exports.fixturesDir = path.join(exports.testDir, 'fixtures');