aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-10 14:37:15 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-11-10 14:37:15 -0800
commitacbf809a3ce0e2f3a3915dc00065ff5e0b20b58f (patch)
tree34ea3cdec03476a29944dfc0a23c9829c4022442 /tests/runner.py
parentf3d23fb5ee8362586c7e986e1d27039fb3a1756b (diff)
bootstrap relooperautomatically
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 413aa804..f965ffb1 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -10141,6 +10141,26 @@ fi
assert ERASING_MESSAGE in output
assert not os.path.exists(EMCC_CACHE)
+ def test_relooper(self):
+ restore()
+ for phase in range(2): # 0: we wipe the relooper dir. 1: we have it, so should just update
+ if phase == 0: Cache.erase()
+ try_delete(RELOOPER)
+
+ for i in range(4):
+ print phase, i
+ opt = min(i, 2)
+ try_delete('a.out.js')
+ output = Popen(['python', EMCC, path_from_root('tests', 'hello_world_loop.cpp'), '-O' + str(opt), '--closure', '0'],
+ stdout=PIPE, stderr=PIPE).communicate()
+ self.assertContained('hello, world!', run_js('a.out.js'))
+ output = '\n'.join(output)
+ assert ('bootstrapping relooper succeeded' in output) == (i == 2), 'only bootstrap on first O2: ' + output
+ assert os.path.exists(RELOOPER) == (i >= 2), 'have relooper on O2: ' + output
+ assert (' checking out' in output) == (i == 2 and phase == 0), 'check out the code on first O2, and if no dir already present: ' + output
+ assert (' updating' in output) == (i == 2 and phase == 1), 'when have relooper dir, just update: ' + output
+ assert ('L2 : do {' in open('a.out.js').read()) == (i >= 2), 'reloop code on O2: ' + output
+
else:
raise Exception('Test runner is confused: ' + str(sys.argv))