diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-18 10:46:47 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-18 10:46:47 -0800 |
commit | c381523b1c1916316f945404630a6e59f7de36b5 (patch) | |
tree | 01ca94d71915b4cd3844d969ebf9ef39903aee8a /tests/runner.py | |
parent | dd68fbf78cf34aacb54c284b474399ef94373045 (diff) |
refactor emcc caching test
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/runner.py b/tests/runner.py index 77deeee7..74868844 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -5994,8 +5994,8 @@ elif 'sanity' in str(sys.argv): self.assertNotContained(SANITY_FAIL_MESSAGE, output) def test_emcc_caching(self): - INCLUDING_DLMALLOC_MESSAGE = 'emcc: including dlmalloc' - BUILDING_DLMALLOC_MESSAGE = 'emcc: building dlmalloc for cache' + INCLUDING_MESSAGE = 'emcc: including X' + BUILDING_MESSAGE = 'emcc: building X for cache' EMCC_CACHE = Cache.dirname @@ -6010,20 +6010,21 @@ elif 'sanity' in str(sys.argv): # Building a file that doesn't need cached stuff should not trigger cache generation output = self.do([EMCC, path_from_root('tests', 'hello_world.cpp')]) - assert INCLUDING_DLMALLOC_MESSAGE not in output - assert BUILDING_DLMALLOC_MESSAGE not in output + assert INCLUDING_MESSAGE.replace('X', 'dlmalloc') not in output + assert BUILDING_MESSAGE.replace('X', 'dlmalloc') not in output self.assertContained('hello, world!', run_js('a.out.js')) assert not os.path.exists(EMCC_CACHE) try_delete('a.out.js') # Building a file that *does* need dlmalloc *should* trigger cache generation, but only the first time - for i in range(3): - output = self.do([EMCC, path_from_root('tests', 'hello_malloc.cpp')]) - assert INCLUDING_DLMALLOC_MESSAGE in output - assert (BUILDING_DLMALLOC_MESSAGE in output) == (i == 0), 'Must only build the first time' - self.assertContained('hello, world!', run_js('a.out.js')) - assert os.path.exists(EMCC_CACHE) - assert os.path.exists(os.path.join(EMCC_CACHE, 'dlmalloc.bc')) + for filename, libname in [('hello_malloc.cpp', 'dlmalloc')]: + for i in range(3): + output = self.do([EMCC, path_from_root('tests', filename)]) + assert INCLUDING_MESSAGE.replace('X', libname) in output + assert (BUILDING_MESSAGE.replace('X', libname) in output) == (i == 0), 'Must only build the first time' + self.assertContained('hello, world!', run_js('a.out.js')) + assert os.path.exists(EMCC_CACHE) + assert os.path.exists(os.path.join(EMCC_CACHE, libname + '.bc')) finally: if emcc_debug: os.environ['EMCC_DEBUG'] = emcc_debug |