diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-04 21:35:22 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-04 21:35:22 -0800 |
commit | 56c1189004dbfa1713dfe418c322906403402d60 (patch) | |
tree | b176cec10d10ebba28d8cb785e1746c2df697207 /check.py | |
parent | 315e543f60541284af52983f10eabc4172ca8937 (diff) | |
download | binaryen-56c1189004dbfa1713dfe418c322906403402d60.tar.gz binaryen-56c1189004dbfa1713dfe418c322906403402d60.tar.bz2 binaryen-56c1189004dbfa1713dfe418c322906403402d60.zip |
infrastructure for wasm2asm testing
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -29,13 +29,13 @@ def fail_if_not_contained(actual, expected): if not interpreter: print '[ no wasm interpreter provided, you should pass one as --interpreter=path/to/interpreter ]' -print '[ checking asm2wasm testcases... ]\n' - if len(requested) == 0: tests = sorted(os.listdir('test')) else: tests = requested[:] +print '[ checking asm2wasm testcases... ]\n' + for asm in tests: if asm.endswith('.asm.js'): print '..', asm @@ -74,6 +74,23 @@ for asm in tests: raise Exception('wasm interpreter error: ' + err) # failed to pretty-print raise Exception('wasm interpreter error') +print '\n[ checking wasm2asm testcases... ]\n' + +for wasm in []:#tests: + if wasm.endswith('.wast'): + print '..', wasm + asm = asm.replace('.wast', '.wasm2asm.js') + actual, err = subprocess.Popen([os.path.join('bin', 'wasm2asm'), os.path.join('test', wasm)], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + assert err == '', 'bad err:' + err + + # verify output + if not os.path.exists(os.path.join('test', asm)): + print actual + raise Exception('output .wast file does not exist') + expected = open(os.path.join('test', aasm)).read() + if actual != expected: + fail(actual, expected) + print '\n[ checking binaryen-shell... ]\n' actual, err = subprocess.Popen([os.path.join('bin', 'binaryen-shell'), '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() |