@@ -68,11 +68,16 @@ def decorated(self):
6868 # Before running the test completely remove the canonical_tmp
6969 if os .path .exists (self .canonical_temp_dir ):
7070 shutil .rmtree (self .canonical_temp_dir )
71- func (self )
72- # Make sure the test isn't lying about the fact that it uses
73- # canonical_tmp
74- self .assertTrue (os .path .exists (self .canonical_temp_dir ))
75- shutil .rmtree (self .canonical_temp_dir )
71+ try :
72+ func (self )
73+ finally :
74+ # Make sure the test isn't lying about the fact that it uses
75+ # canonical_tmp
76+ self .assertTrue (os .path .exists (self .canonical_temp_dir ))
77+ # Remove the temp dir in a try-finally, as otherwise if the
78+ # test fails we would not clean it up, and if leak detection
79+ # is set we will show that error instead of the actual one.
80+ shutil .rmtree (self .canonical_temp_dir )
7681
7782 return decorated
7883
@@ -2338,7 +2343,7 @@ def test_debuginfo(self):
23382343 else :
23392344 self .assertNotIn (' -g ' , finalize )
23402345 else :
2341- opts = '\n ' .join ([l for l in lines if 'LLVM opts: ' in l ])
2346+ opts = '\n ' .join ([l for l in lines if os . path . sep + 'opt ' in l ])
23422347 if expect_debug :
23432348 self .assertNotIn ('strip-debug' , opts )
23442349 else :
@@ -3551,11 +3556,11 @@ def test_fs_after_main(self):
35513556 def test_os_oz (self ):
35523557 with env_modify ({'EMCC_DEBUG' : '1' }):
35533558 for args , expect in [
3554- (['-O1' ], 'LLVM opts: -O1' ),
3555- (['-O2' ], 'LLVM opts: -O3' ),
3556- (['-Os' ], 'LLVM opts: -Os' ),
3557- (['-Oz' ], 'LLVM opts: -Oz' ),
3558- (['-O3' ], 'LLVM opts: -O3' ),
3559+ (['-O1' ], '-O1' ),
3560+ (['-O2' ], '-O3' ),
3561+ (['-Os' ], '-Os' ),
3562+ (['-Oz' ], '-Oz' ),
3563+ (['-O3' ], '-O3' ),
35593564 ]:
35603565 print (args , expect )
35613566 err = run_process ([PYTHON , EMCC , path_from_root ('tests' , 'hello_world.cpp' )] + args , stdout = PIPE , stderr = PIPE ).stderr
@@ -5871,7 +5876,8 @@ def test(args, llvm_opts=None):
58715876
58725877 if args :
58735878 assert err .count (VECTORIZE ) == 2 , err # specified twice, once per file
5874- assert err .count ('emcc: LLVM opts: ' + llvm_opts ) == 2 , err # corresponding to exactly once per invocation of optimizer
5879+ # corresponding to exactly once per invocation of optimizer
5880+ assert err .count (os .path .sep + 'opt' ) == 2 , err
58755881 else :
58765882 assert err .count (VECTORIZE ) == 0 , err # no optimizations
58775883
0 commit comments