@@ -144,15 +144,26 @@ 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
+ test .config .substitutions .append (('%T' , tmp_base ))
158
+
147
159
if self .coverage_mode :
148
160
# FIXME: The compiler crashers run so fast they fill up the
149
161
# merger's queue (and therefore the build bot's disk)
150
162
if 'crasher' in test .getSourcePath ():
151
163
test .config .environment ["LLVM_PROFILE_FILE" ] = os .devnull
152
164
self .skipped_tests .add (test .getSourcePath ())
153
165
return
154
-
155
- _ , tmp_base = lit .TestRunner .getTempPaths (test )
166
+
156
167
if self .coverage_mode == "NOT_MERGED" :
157
168
profdir = tmp_base + '.profdir'
158
169
if not os .path .exists (profdir ):
@@ -357,11 +368,6 @@ completion_cache_path = tempfile.mkdtemp(prefix="swift-testsuite-completion-cach
357
368
ccp_opt = "-completion-cache-path %r" % completion_cache_path
358
369
lit_config .note ("Using code completion cache: " + completion_cache_path )
359
370
360
- # Apparently despite the docs, tmpDir is not actually unique for each test, but
361
- # tmpBase is. Speculative fix for rdar://31520207.
362
- config .substitutions .remove ( ('%T' , tmpDir ) )
363
- config .substitutions .append ( ('%T' , tmpBase ) )
364
-
365
371
config .substitutions .append ( ('%swift_obj_root' , config .swift_obj_root ) )
366
372
config .substitutions .append ( ('%swift_src_root' , config .swift_src_root ) )
367
373
config .substitutions .append ( ('%{python}' , sys .executable ) )
0 commit comments