test: simplify common.PORT code

common.PORT is no longer used in parallelized tests and should not be.
Remove code that accommodates parallelized tests.

PR-URL: https://github.com/nodejs/node/pull/17559
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This commit is contained in:
Rich Trott 2017-12-08 18:03:30 -08:00 committed by Myles Borins
parent f7a1e39139
commit 39e2fb6ad4
No known key found for this signature in database
GPG Key ID: 933B01F40B5CA946
2 changed files with 3 additions and 6 deletions

View File

@ -39,8 +39,9 @@ const noop = () => {};
// Using a `.` prefixed name, which is the convention for "hidden" on POSIX,
// gets tools to ignore it by default or by simple rules, especially eslint.
let tmpDirName = '.tmp';
// PORT should match the definition in test/testpy/__init__.py.
exports.PORT = +process.env.NODE_COMMON_PORT || 12346;
exports.isWindows = process.platform === 'win32';
exports.isWOW64 = exports.isWindows &&
(process.env.PROCESSOR_ARCHITEW6432 !== undefined);
@ -162,7 +163,6 @@ exports.refreshTmpDir = function() {
};
if (process.env.TEST_THREAD_ID) {
exports.PORT += process.env.TEST_THREAD_ID * 100;
tmpDirName += `.${process.env.TEST_THREAD_ID}`;
}
exports.tmpDir = path.join(testRoot, tmpDirName);

View File

@ -61,10 +61,7 @@ class SimpleTestCase(test.TestCase):
source = open(self.file).read()
flags_match = FLAGS_PATTERN.search(source)
if flags_match:
# PORT should match the definition in test/common/index.js.
env = { 'PORT': int(os.getenv('NODE_COMMON_PORT', '12346')) }
env['PORT'] += self.thread_id * 100
flag = flags_match.group(1).strip().format(**env).split()
flag = flags_match.group(1).strip().split()
# The following block reads config.gypi to extract the v8_enable_inspector
# value. This is done to check if the inspector is disabled in which case
# the '--inspect' flag cannot be passed to the node process as it will