aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-21 21:27:05 +0100
committerAlon Zakai <alonzakai@gmail.com>2012-11-21 21:27:05 +0100
commite385931c501dcca3767e16fc8531150493131e59 (patch)
tree9bae2c7e85d54fcebcbd4526062ec87fc5e0b0ca /tests
parent9ec292c78afd5e5bbd25ac152e16dbcc33a0e905 (diff)
finish js optimizer caching and add tests
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 881b9a36..3401c621 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -10456,8 +10456,10 @@ fi
def test_jcache(self):
PRE_LOAD_MSG = 'loading pre from jcache'
PRE_SAVE_MSG = 'saving pre to jcache'
- FUNC_CHUNKS_LOAD_MSG = 'funcchunks from jcache'
- FUNC_CHUNKS_SAVE_MSG = 'funcchunks to jcache'
+ FUNC_CHUNKS_LOAD_MSG = ' funcchunks from jcache'
+ FUNC_CHUNKS_SAVE_MSG = ' funcchunks to jcache'
+ JSFUNC_CHUNKS_LOAD_MSG = 'jsfuncchunks from jcache'
+ JSFUNC_CHUNKS_SAVE_MSG = 'jsfuncchunks to jcache'
restore()
Cache.erase()
@@ -10484,16 +10486,21 @@ fi
]:
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()
+ out, err = Popen(['python', EMCC, '-O2', '--closure', '0', path_from_root('tests', input_file)] + args, stdout=PIPE, stderr=PIPE).communicate()
+ self.assertContained('hello, world!', run_js('a.out.js'))
assert (PRE_SAVE_MSG in err) == expect_save, err
assert (PRE_LOAD_MSG in err) == expect_load, err
assert (FUNC_CHUNKS_SAVE_MSG in err) == expect_save, err
assert (FUNC_CHUNKS_LOAD_MSG in err) == expect_load, err
+ assert (JSFUNC_CHUNKS_SAVE_MSG in err) == expect_save, err
+ assert (JSFUNC_CHUNKS_LOAD_MSG in err) == expect_load, err
curr = open('a.out.js').read()
if input_file not in srcs:
srcs[input_file] = curr
else:
- assert curr == srcs[input_file], err
+ #open('/home/alon/Dev/emscripten/a', 'w').write(srcs[input_file])
+ #open('/home/alon/Dev/emscripten/b', 'w').write(curr)
+ assert len(curr) == len(srcs[input_file]), 'contents may shift in order, but must remain the same size %d vs %d' % (len(curr), len(srcs[input_file])) + '\n' + err
used_jcache = used_jcache or ('--jcache' in args)
assert used_jcache == os.path.exists(JCache.get_cachename('emscript_files'))