@@ -144,15 +144,28 @@ class SwiftTest(lit.formats.ShTest, object):
144
144
self .skipped_tests = set ()
145
145
146
146
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
+
147
161
if self .coverage_mode :
148
162
# FIXME: The compiler crashers run so fast they fill up the
149
163
# merger's queue (and therefore the build bot's disk)
150
164
if 'crasher' in test .getSourcePath ():
151
165
test .config .environment ["LLVM_PROFILE_FILE" ] = os .devnull
152
166
self .skipped_tests .add (test .getSourcePath ())
153
167
return
154
-
155
- _ , tmp_base = lit .TestRunner .getTempPaths (test )
168
+
156
169
if self .coverage_mode == "NOT_MERGED" :
157
170
profdir = tmp_base + '.profdir'
158
171
if not os .path .exists (profdir ):
0 commit comments