diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-09 09:21:15 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-09 09:21:15 -0800 |
commit | a69c712141706578a6dcd4f092bf0222273c8e0a (patch) | |
tree | 24ad24f49ff606f758c1dedc212e397c436f041e /tests | |
parent | 92a6658da855b0e6bb9bd157992912e242985e76 (diff) |
test for asm minifier sizes
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index cdc8684b..eb7c468f 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -8927,6 +8927,32 @@ f.close() Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'test.cpp'), '-s', 'UNALIGNED_MEMORY=1']).communicate() self.assertContained('testString = Hello, World!', run_js(os.path.join(self.get_dir(), 'a.out.js'))) + def test_asm_minify(self): + def test(args): + Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_loop_malloc.cpp')] + args).communicate() + self.assertContained('hello, world!', run_js(self.in_dir('a.out.js'))) + return open(self.in_dir('a.out.js')).read() + + src = test([]) + assert 'function _malloc' in src + + src = test(['-O2', '-s', 'ASM_JS=1']) + normal_size = len(src) + print 'normal', normal_size + assert 'function _malloc' not in src + + src = test(['-O2', '-s', 'ASM_JS=1', '--minify', '0']) + unminified_size = len(src) + print 'unminified', unminified_size + assert unminified_size > normal_size + assert 'function _malloc' not in src + + src = test(['-O2', '-s', 'ASM_JS=1', '-g']) + debug_size = len(src) + print 'debug', debug_size + assert debug_size > unminified_size + assert 'function _malloc' in src + def test_l_link(self): # Linking with -lLIBNAME and -L/DIRNAME should work |