test: use unique tmpdirs for each test
Tests can leave processes running blocking the tmpdir. This does not yet prevent tests from doing that, but prevents failures on subsequent tests. PR-URL: https://github.com/nodejs/node/pull/28858 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
df936c5925
commit
d3f20a4725
@ -89,7 +89,8 @@ const testRoot = process.env.NODE_TEST_DIR ?
|
||||
|
||||
// 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.
|
||||
const tmpdirName = '.tmp.' + (process.env.TEST_THREAD_ID || '0');
|
||||
const tmpdirName = '.tmp.' +
|
||||
(process.env.TEST_SERIAL_ID || process.env.TEST_THREAD_ID || '0');
|
||||
const tmpPath = path.join(testRoot, tmpdirName);
|
||||
|
||||
function refresh(opts = {}) {
|
||||
|
@ -77,6 +77,7 @@ class ProgressIndicator(object):
|
||||
|
||||
def __init__(self, cases, flaky_tests_mode):
|
||||
self.cases = cases
|
||||
self.serial_id = 0
|
||||
self.flaky_tests_mode = flaky_tests_mode
|
||||
self.parallel_queue = Queue(len(cases))
|
||||
self.sequential_queue = Queue(len(cases))
|
||||
@ -146,6 +147,8 @@ class ProgressIndicator(object):
|
||||
case = test
|
||||
case.thread_id = thread_id
|
||||
self.lock.acquire()
|
||||
case.serial_id = self.serial_id
|
||||
self.serial_id += 1
|
||||
self.AboutToRun(case)
|
||||
self.lock.release()
|
||||
try:
|
||||
@ -504,6 +507,7 @@ class TestCase(object):
|
||||
self.mode = mode
|
||||
self.parallel = False
|
||||
self.disable_core_files = False
|
||||
self.serial_id = 0
|
||||
self.thread_id = 0
|
||||
|
||||
def IsNegative(self):
|
||||
@ -535,6 +539,7 @@ class TestCase(object):
|
||||
def Run(self):
|
||||
try:
|
||||
result = self.RunCommand(self.GetCommand(), {
|
||||
"TEST_SERIAL_ID": "%d" % self.serial_id,
|
||||
"TEST_THREAD_ID": "%d" % self.thread_id,
|
||||
"TEST_PARALLEL" : "%d" % self.parallel
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user