summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-04 21:35:22 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-12-04 21:35:22 -0800
commit56c1189004dbfa1713dfe418c322906403402d60 (patch)
treeb176cec10d10ebba28d8cb785e1746c2df697207 /check.py
parent315e543f60541284af52983f10eabc4172ca8937 (diff)
downloadbinaryen-56c1189004dbfa1713dfe418c322906403402d60.tar.gz
binaryen-56c1189004dbfa1713dfe418c322906403402d60.tar.bz2
binaryen-56c1189004dbfa1713dfe418c322906403402d60.zip
infrastructure for wasm2asm testing
Diffstat (limited to 'check.py')
-rwxr-xr-xcheck.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/check.py b/check.py
index 33dacdcb9..cab2d5445 100755
--- a/check.py
+++ b/check.py
@@ -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()