diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-12 18:27:53 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-12 18:27:53 -0800 |
commit | db37551c793b6ecbef610f00fe4b6018e1e54b21 (patch) | |
tree | 60c6c4bda46265a7993a3ecb264c7070d426b2fa /tests/runner.py | |
parent | 7782c8cd4e7b186f0cbd5e78cf5ee4e843d82565 (diff) |
additional -s emcc tests
Diffstat (limited to 'tests/runner.py')
-rw-r--r-- | tests/runner.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/runner.py b/tests/runner.py index b3c7d1d9..33e434e4 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -4966,13 +4966,19 @@ JavaScript in the final linking stage of building. if opt_level >= 3: assert 'Module._main = ' in generated, 'closure compiler should have been run' # emcc -s RELOOP=1 src.cpp ==> should pass -s to emscripten.py - clear() - output = Popen([compiler, path_from_root('tests', 'hello_world' + suffix), '-s', 'USE_TYPED_ARRAYS=0'], stdout=PIPE, stderr=PIPE).communicate() - assert len(output[0]) == 0, output[0] - assert os.path.exists('a.out.js'), '\n'.join(output) - self.assertContained('hello, world!', run_js('a.out.js')) - generated = open('a.out.js').read() - assert 'new Int32Array' not in generated, 'asking for no typed arrays should work' + for params, test, text in [ + (['-s', 'USE_TYPED_ARRAYS=0'], lambda generated: 'new Int32Array' not in generated, 'disable typed arrays'), + (['-s', 'USE_TYPED_ARRAYS=1'], lambda generated: 'IHEAPU = ' in generated, 'typed arrays 1 selected'), + ([], lambda generated: 'Module["_dump"]' not in generated, 'dump is not exported by default'), + (['-s', 'EXPORTED_FUNCTIONS=["_main", "_dump"]'], lambda generated: 'Module["_dump"]' in generated, 'dump is now exported') + ]: + clear() + output = Popen([compiler, path_from_root('tests', 'hello_world_loop.cpp')] + params, stdout=PIPE, stderr=PIPE).communicate() + assert len(output[0]) == 0, output[0] + assert os.path.exists('a.out.js'), '\n'.join(output) + self.assertContained('hello, world!', run_js('a.out.js')) + assert test(open('a.out.js').read()), text + # emcc --llvm-opts=x .. ==> pick level of LLVM optimizations (default is 0, to be safe?) # When doing unsafe opts, can we run -Ox on the source, not just at the very end? |