aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-21 14:53:45 +0100
committerAlon Zakai <alonzakai@gmail.com>2012-11-21 20:47:02 +0100
commitcbfcb2e9f1591407cd4d64c1a0237c4783fe2450 (patch)
tree6377d3161c878d8f65c67c0fa58f3acf672c36ea /tests
parentcd80d52b85e0b0d35aa7d05d5b53a460c3b3c0f1 (diff)
fix emscript funcs caching and add testing
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 0b0a41ca..d93105ed 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -10461,7 +10461,9 @@ fi
assert not os.path.exists(JCache.get_cachename('emscript_files'))
- src = None
+ srcs = {}
+ used_jcache = False
+
for args, input_file, expect_save, expect_load in [
([], 'hello_world_loop.cpp', False, False),
(['--jcache'], 'hello_world_loop.cpp', True, False),
@@ -10473,7 +10475,7 @@ fi
([], 'hello_world.cpp', False, False),
(['--jcache'], 'hello_world_loop.cpp', False, True), # go back to old file, experience caching
]:
- print args, input_file, expect_save, expect_load
+ print >> sys.stderr, args, input_file, expect_save, expect_load
self.clear()
out, err = Popen(['python', EMCC, path_from_root('tests', input_file)] + args, stdout=PIPE, stderr=PIPE).communicate()
assert (PRE_SAVE_MSG in err) == expect_save, err
@@ -10481,12 +10483,12 @@ fi
assert (FUNC_CHUNKS_SAVE_MSG in err) == expect_save, err
assert (FUNC_CHUNKS_LOAD_MSG in err) == expect_load, err
curr = open('a.out.js').read()
- if src is None:
- src = None
+ if input_file not in srcs:
+ srcs[input_file] = curr
else:
- assert src == curr, 'caching must not affect codegen'
-
- assert os.path.exists(JCache.get_cachename('emscript_files'))
+ assert curr == srcs[input_file], err
+ used_jcache = used_jcache or ('--jcache' in args)
+ assert used_jcache == os.path.exists(JCache.get_cachename('emscript_files'))
finally:
del os.environ['EMCC_DEBUG']