Skip to content

Commit

Permalink
tools: make --repeat work with -j in test.py
Browse files Browse the repository at this point in the history
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
PR-URL: #9249
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
  • Loading branch information
Trott authored and Myles Borins committed Nov 22, 2016
1 parent 9d5e7f5 commit 533ce48
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import utils
import multiprocessing
import errno
import copy

from os.path import join, dirname, abspath, basename, isdir, exists
from datetime import datetime
Expand Down Expand Up @@ -796,7 +797,9 @@ def AddTestsToList(self, result, current_path, path, context, arch, mode):
tests = self.GetConfiguration(context).ListTests(current_path, path,
arch, mode)
for t in tests: t.variant_flags = v
result += tests * context.repeat
result += tests
for i in range(1, context.repeat):
result += copy.deepcopy(tests)

def GetTestStatus(self, context, sections, defs):
self.GetConfiguration(context).GetTestStatus(sections, defs)
Expand Down

0 comments on commit 533ce48

Please sign in to comment.