aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-14 14:16:41 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-14 14:16:41 -0800
commit9dc655352d00dfc19752de971f4906bebb945f7f (patch)
treee84295d8ad7651988e17ce7ea6af9f02b17d86af
parentaa06e063ffbbd62f5a1a6e617fbb52110bd4590e (diff)
test emcc optimization on bitcode files
-rw-r--r--tests/runner.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/runner.py b/tests/runner.py
index f58a0368..d0bf7000 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -4917,19 +4917,26 @@ Options that are modified or new in %s include:
# Optimization: emcc src.cpp -o something.js [-Ox]. -O0 is the same as not specifying any optimization setting
for params, opt_level, bc_params in [ # bc params are used after compiling to bitcode
- (['-o', 'something.js'], 0, None),
+ (['-o', 'something.js'], 0, None),
(['-o', 'something.js', '-O0'], 0, None),
(['-o', 'something.js', '-O1'], 1, None),
(['-o', 'something.js', '-O2'], 2, None),
(['-o', 'something.js', '-O3'], 3, None),
+ # and, test compiling to bitcode first
+ (['-o', 'something.bc'], 0, []),
+ (['-o', 'something.bc'], 0, ['-O0']),
+ (['-o', 'something.bc'], 1, ['-O1']),
+ (['-o', 'something.bc'], 2, ['-O2']),
+ (['-o', 'something.bc'], 3, ['-O3']),
]:
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]
- if bc_params:
- output = Popen([compiler, 'something.bc'] + bc_params, stdout=PIPE, stderr=PIPE).communicate()
- assert os.path.exists('something.js'), '\n'.join(output)
+ if bc_params is not None:
+ assert os.path.exists('something.bc'), output[1]
+ output = Popen([compiler, 'something.bc', '-o', 'something.js'] + bc_params, stdout=PIPE, stderr=PIPE).communicate()
+ assert os.path.exists('something.js'), output[1]
assert ('Warning: The relooper optimization can be very slow.' in output[1]) == (opt_level >= 2), 'relooper warning should appear in opt >= 2'
assert ('Warning: Applying some potentially unsafe optimizations!' in output[1]) == (opt_level >= 3), 'unsafe warning should appear in opt >= 3'
self.assertContained('hello, world!', run_js('something.js'))