summaryrefslogtreecommitdiff
path: root/auto_update_tests.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-18 14:18:52 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-12-18 14:18:52 -0800
commit1728102c32ee94dae1269bbba15e1c9836fdc8fb (patch)
tree3e2794b0e753c497a6d8d57af3519c98628f1698 /auto_update_tests.py
parente7e30dfabf39b84ad11179a3638acbbbaa8ef071 (diff)
downloadbinaryen-1728102c32ee94dae1269bbba15e1c9836fdc8fb.tar.gz
binaryen-1728102c32ee94dae1269bbba15e1c9836fdc8fb.tar.bz2
binaryen-1728102c32ee94dae1269bbba15e1c9836fdc8fb.zip
update tests
Diffstat (limited to 'auto_update_tests.py')
-rwxr-xr-xauto_update_tests.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index ed4401549..67f71b69b 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -7,13 +7,8 @@ print '[ processing and updating testcases... ]\n'
for asm in sorted(os.listdir('test')):
if asm.endswith('.asm.js'):
print '..', asm
- wasm = asm.replace('.asm.js', '.wast')
+ wasm = asm.replace('.asm.js', '.fromasm')
actual, err = subprocess.Popen([os.path.join('bin', 'asm2wasm'), os.path.join('test', asm)], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
-
- # verify output
- if not os.path.exists(os.path.join('test', wasm)):
- print actual
- raise Exception('output .wast file does not exist')
open(os.path.join('test', wasm), 'w').write(actual)
for wasm in sorted(os.listdir('test')):
@@ -45,5 +40,23 @@ for s in sorted(os.listdir(os.path.join('test', 'dot_s'))) + sorted(os.listdir(o
expected_file = os.path.join('test', 'dot_s', wasm)
open(expected_file, 'w').write(actual)
+for wasm in ['min.wast', 'hello_world.wast', 'unit.wast', 'emcc_O2_hello_world.wast', 'emcc_hello_world.wast']:
+ if wasm.endswith('.wast'):
+ print '..', wasm
+ asm = wasm.replace('.wast', '.2asm.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
+ expected_file = os.path.join('test', asm)
+ open(expected_file, 'w').write(actual)
+
+for t in sorted(os.listdir(os.path.join('test', 'passes'))):
+ if t.endswith('.wast'):
+ print '..', t
+ passname = os.path.basename(t).replace('.wast', '')
+ cmd = [os.path.join('bin', 'binaryen-shell'), '-print-before', '-print-after', '-' + passname, os.path.join('test', 'passes', t)]
+ print ' ', ' '.join(cmd)
+ actual, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
+ open(os.path.join('test', 'passes', passname + '.txt'), 'w').write(actual)
+
print '\n[ success! ]'