Skip to content

Commit 7ea8ad0

Browse files
author
Dave Abrahams
authored
Merge pull request #10506 from apple/unique-test-output-dirs
Speculative fix for test output race conditions @gparker42 is going to verify that it allows us to re-enable parallel device testing.
2 parents e7a0ba8 + da87126 commit 7ea8ad0

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/lit.cfg

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,28 @@ class SwiftTest(lit.formats.ShTest, object):
144144
self.skipped_tests = set()
145145

146146
def before_test(self, test, litConfig):
147+
_, tmp_base = lit.TestRunner.getTempPaths(test)
148+
149+
# Apparently despite the docs, tmpDir is not actually unique for each test, but
150+
# tmpBase is. Remove it here and add a tmpBase substitution in before_test.
151+
# Speculative fix for rdar://32928464.
152+
try:
153+
percentT_index = [x[0] for x in test.config.substitutions].index('%T')
154+
except ValueError: pass
155+
else:
156+
test.config.substitutions.pop(percentT_index)
157+
158+
test.config.substitutions.append(
159+
('%T', '$(mkdir -p %r && echo %r)' % (tmp_base, tmp_base)))
160+
147161
if self.coverage_mode:
148162
# FIXME: The compiler crashers run so fast they fill up the
149163
# merger's queue (and therefore the build bot's disk)
150164
if 'crasher' in test.getSourcePath():
151165
test.config.environment["LLVM_PROFILE_FILE"] = os.devnull
152166
self.skipped_tests.add(test.getSourcePath())
153167
return
154-
155-
_, tmp_base = lit.TestRunner.getTempPaths(test)
168+
156169
if self.coverage_mode == "NOT_MERGED":
157170
profdir = tmp_base + '.profdir'
158171
if not os.path.exists(profdir):

0 commit comments

Comments
 (0)