@@ -10461,7 +10461,9 @@ def test_jcache(self):
1046110461
1046210462 assert not os .path .exists (JCache .get_cachename ('emscript_files' ))
1046310463
10464- src = None
10464+ srcs = {}
10465+ used_jcache = False
10466+
1046510467 for args , input_file , expect_save , expect_load in [
1046610468 ([], 'hello_world_loop.cpp' , False , False ),
1046710469 (['--jcache' ], 'hello_world_loop.cpp' , True , False ),
@@ -10473,20 +10475,20 @@ def test_jcache(self):
1047310475 ([], 'hello_world.cpp' , False , False ),
1047410476 (['--jcache' ], 'hello_world_loop.cpp' , False , True ), # go back to old file, experience caching
1047510477 ]:
10476- print args , input_file , expect_save , expect_load
10478+ print >> sys . stderr , args , input_file , expect_save , expect_load
1047710479 self .clear ()
1047810480 out , err = Popen (['python' , EMCC , path_from_root ('tests' , input_file )] + args , stdout = PIPE , stderr = PIPE ).communicate ()
1047910481 assert (PRE_SAVE_MSG in err ) == expect_save , err
1048010482 assert (PRE_LOAD_MSG in err ) == expect_load , err
1048110483 assert (FUNC_CHUNKS_SAVE_MSG in err ) == expect_save , err
1048210484 assert (FUNC_CHUNKS_LOAD_MSG in err ) == expect_load , err
1048310485 curr = open ('a.out.js' ).read ()
10484- if src is None :
10485- src = None
10486+ if input_file not in srcs :
10487+ srcs [ input_file ] = curr
1048610488 else :
10487- assert src == curr , 'caching must not affect codegen'
10488-
10489- assert os .path .exists (JCache .get_cachename ('emscript_files' ))
10489+ assert curr == srcs [ input_file ], err
10490+ used_jcache = used_jcache or ( '--jcache' in args )
10491+ assert used_jcache == os .path .exists (JCache .get_cachename ('emscript_files' ))
1049010492
1049110493 finally :
1049210494 del os .environ ['EMCC_DEBUG' ]
0 commit comments