diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-07 09:59:35 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-07 09:59:35 -0800 |
commit | 4a6e77e0486e06479d9700a7e2f768e3fd7162e6 (patch) | |
tree | 6a81c234be3bcb7901fb3af7c56df1c446b4b03f | |
parent | 43337adaec7974708621e1914df99c69b0722656 (diff) |
test coverage for splitting each function out into an emscript chunk
-rwxr-xr-x | emscripten.py | 2 | ||||
-rwxr-xr-x | tests/runner.py | 26 |
2 files changed, 18 insertions, 10 deletions
diff --git a/emscripten.py b/emscripten.py index 1f020fd4..687adb66 100755 --- a/emscripten.py +++ b/emscripten.py @@ -44,6 +44,7 @@ def scan(ll, settings): NUM_CHUNKS_PER_CORE = 4 MIN_CHUNK_SIZE = 1024*1024 +MAX_CHUNK_SIZE = float(os.environ.get('EMSCRIPT_MAX_CHUNK_SIZE') or 'inf') # configuring this is just for debugging purposes def process_funcs(args): i, ll, settings_file, compiler, forwarded_file, libraries = args @@ -147,6 +148,7 @@ def emscript(infile, settings, outfile, libraries=[]): intended_num_chunks = cores * NUM_CHUNKS_PER_CORE chunk_size = max(MIN_CHUNK_SIZE, total_ll_size / intended_num_chunks) chunk_size += 3*len(meta) # keep ratio of lots of function code to meta + chunk_size = min(MAX_CHUNK_SIZE, chunk_size) if DEBUG: t = time.time() forwarded_json = json.loads(forwarded_data) diff --git a/tests/runner.py b/tests/runner.py index 4add6330..a5d5045a 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -1123,16 +1123,22 @@ c5,de,15,8a self.do_run(open(path_from_root('tests', 'cube2md5.cpp')).read(), open(path_from_root('tests', 'cube2md5.ok')).read()) def test_cube2hash(self): - # A good test of i64 math - if Settings.USE_TYPED_ARRAYS != 2: return self.skip('requires ta2 C-style memory aliasing') - self.do_run('', 'Usage: hashstring <seed>', - libraries=self.get_library('cube2hash', ['cube2hash.bc'], configure=None), - includes=[path_from_root('tests', 'cube2hash')]) - - for text, output in [('fleefl', '892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9'), - ('fleefl2', 'AA2CC5F96FC9D540CA24FDAF1F71E2942753DB83E8A81B61'), - ('64bitisslow', '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670')]: - self.do_run('', 'hash value: ' + output, [text], no_build=True) + try: + old_chunk_size = os.environ.get('EMSCRIPT_MAX_CHUNK_SIZE') or '' + os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = '1' # test splitting out each function to a chunk in emscripten.py (21 functions here) + + # A good test of i64 math + if Settings.USE_TYPED_ARRAYS != 2: return self.skip('requires ta2 C-style memory aliasing') + self.do_run('', 'Usage: hashstring <seed>', + libraries=self.get_library('cube2hash', ['cube2hash.bc'], configure=None), + includes=[path_from_root('tests', 'cube2hash')]) + + for text, output in [('fleefl', '892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9'), + ('fleefl2', 'AA2CC5F96FC9D540CA24FDAF1F71E2942753DB83E8A81B61'), + ('64bitisslow', '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670')]: + self.do_run('', 'hash value: ' + output, [text], no_build=True) + finally: + os.environ['EMSCRIPT_MAX_CHUNK_SIZE'] = old_chunk_size def test_unaligned(self): if Settings.QUANTUM_SIZE == 1: return self.skip('No meaning to unaligned addresses in q1') |