@@ -390,8 +390,8 @@ def test_em_config_env_var(self):
390
390
391
391
self .assertContained ('hello from emcc with no config file' , self .run_js ('a.out.js' ))
392
392
393
- def erase_cache (self ):
394
- Cache . erase ( )
393
+ def clear_cache (self ):
394
+ self . run_process ([ EMCC , '--clear-cache' ] )
395
395
self .assertCacheEmpty ()
396
396
397
397
def assertCacheEmpty (self ):
@@ -406,7 +406,7 @@ def test_emcc_caching(self):
406
406
BUILDING_MESSAGE = 'generating system library: %s'
407
407
408
408
restore_and_set_up ()
409
- self .erase_cache ()
409
+ self .clear_cache ()
410
410
411
411
# Building a file that *does* need something *should* trigger cache
412
412
# generation, but only the first time
@@ -425,7 +425,7 @@ def test_cache_clearing_manual(self):
425
425
# Manual cache clearing
426
426
restore_and_set_up ()
427
427
self .ensure_cache ()
428
- self .assertTrue ( os . path . exists ( Cache .dirname ) )
428
+ self .assertExists ( Cache .dirname )
429
429
output = self .do ([EMCC , '--clear-cache' ])
430
430
self .assertIn ('clearing cache' , output )
431
431
self .assertIn (SANITY_MESSAGE , output )
@@ -438,24 +438,24 @@ def test_cache_clearing_auto(self):
438
438
make_fake_clang (self .in_dir ('fake' , 'bin' , 'clang' ), EXPECTED_LLVM_VERSION )
439
439
make_fake_llc (self .in_dir ('fake' , 'bin' , 'llc' ), 'got wasm32 backend! WebAssembly 32-bit' )
440
440
with env_modify ({'EM_LLVM_ROOT' : self .in_dir ('fake' , 'bin' )}):
441
- self .assertTrue ( os . path . exists ( Cache .dirname ) )
441
+ self .assertExists ( Cache .dirname )
442
442
output = self .do ([EMCC ])
443
443
self .assertIn ('clearing cache' , output )
444
444
self .assertCacheEmpty ()
445
445
446
446
# FROZEN_CACHE prevents cache clears, and prevents building
447
447
def test_FROZEN_CACHE (self ):
448
448
restore_and_set_up ()
449
- self .erase_cache ()
449
+ self .clear_cache ()
450
450
self .ensure_cache ()
451
- self .assertTrue ( os . path . exists ( Cache .dirname ) )
451
+ self .assertExists ( Cache .dirname )
452
452
# changing config file should not clear cache
453
453
add_to_config ('FROZEN_CACHE = True' )
454
454
self .do ([EMCC ])
455
- self .assertTrue ( os . path . exists ( Cache .dirname ) )
455
+ self .assertExists ( Cache .dirname )
456
456
# building libraries is disallowed
457
457
output = self .do ([EMBUILDER , 'build' , 'libemmalloc' ])
458
- self .assertIn ('FROZEN_CACHE disallows building system libs ' , output )
458
+ self .assertContained ('FROZEN_CACHE is set, but cache file is missing ' , output )
459
459
460
460
# Test that if multiple processes attempt to access or build stuff to the
461
461
# cache on demand, that exactly one of the processes will, and the other
@@ -484,9 +484,9 @@ def test_emcc_multiprocess_cache_access(self):
484
484
num_times_libc_was_built += 1
485
485
486
486
# The cache directory must exist after the build
487
- self .assertTrue ( os . path . exists ( cache_dir_name ) )
487
+ self .assertExists ( cache_dir_name )
488
488
# The cache directory must contain a built libc
489
- self .assertTrue (os .path .exists ( os . path . join (cache_dir_name , libname ) ))
489
+ self .assertExists (os .path .join (cache_dir_name , libname ))
490
490
# Exactly one child process should have triggered libc build!
491
491
self .assertEqual (num_times_libc_was_built , 1 )
492
492
@@ -625,19 +625,19 @@ def test():
625
625
626
626
print ('normal build' )
627
627
with env_modify ({'EMCC_FORCE_STDLIBS' : None }):
628
- Cache . erase ()
628
+ self . clear_cache ()
629
629
build ()
630
630
test ()
631
631
632
632
print ('wacky env vars, these should not mess our bootstrapping' )
633
633
with env_modify ({'EMCC_FORCE_STDLIBS' : '1' }):
634
- Cache . erase ()
634
+ self . clear_cache ()
635
635
build ()
636
636
test ()
637
637
638
638
def test_vanilla (self ):
639
639
restore_and_set_up ()
640
- Cache . erase ()
640
+ self . clear_cache ()
641
641
642
642
def make_fake (report ):
643
643
with open (config_file , 'a' ) as f :
@@ -689,10 +689,10 @@ def test_embuilder_force_port(self):
689
689
def test_embuilder_wasm_backend (self ):
690
690
restore_and_set_up ()
691
691
# the --lto flag makes us build wasm-bc
692
- self .do ([ EMCC , '--clear-cache' ] )
692
+ self .clear_cache ( )
693
693
self .run_process ([EMBUILDER , 'build' , 'libemmalloc' ])
694
694
self .assertExists (os .path .join (config .CACHE , 'sysroot' , 'lib' , 'wasm32-emscripten' ))
695
- self .do ([ EMCC , '--clear-cache' ] )
695
+ self .clear_cache ( )
696
696
self .run_process ([EMBUILDER , 'build' , 'libemmalloc' , '--lto' ])
697
697
self .assertExists (os .path .join (config .CACHE , 'sysroot' , 'lib' , 'wasm32-emscripten' , 'lto' ))
698
698
0 commit comments