Skip to content

Commit d60f00a

Browse files
committed
tools: make --repeat work with -j in test.py
The repeat option in test.py did not work as expected if `-j` was set to more than one. Repeated tests running at the same time could share temp directories and cause test failures. This was observed with: tools/test.py -J --repeat=10 parallel/test-fs-watch-recursive By using copy.deepCopy(), the repeated tests are separate objects and not references to the same objects. Setting `thread_id` on one of them will now not change the `thread_id` on all of them. And `thread_id` is how the temp directory (and common.PORT as well) are determined. Refs: #9228
1 parent 6e5389e commit d60f00a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import utils
4343
import multiprocessing
4444
import errno
45+
import copy
4546

4647
from os.path import join, dirname, abspath, basename, isdir, exists
4748
from datetime import datetime
@@ -773,7 +774,9 @@ def AddTestsToList(self, result, current_path, path, context, arch, mode):
773774
tests = self.GetConfiguration(context).ListTests(current_path, path,
774775
arch, mode)
775776
for t in tests: t.variant_flags = v
776-
result += tests * context.repeat
777+
result += tests
778+
for i in range(1, context.repeat):
779+
result += copy.deepcopy(tests)
777780

778781
def GetTestStatus(self, context, sections, defs):
779782
self.GetConfiguration(context).GetTestStatus(sections, defs)

0 commit comments

Comments
 (0)