summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'check.py')
-rwxr-xr-xcheck.py51
1 files changed, 35 insertions, 16 deletions
diff --git a/check.py b/check.py
index f3d8b02e0..b11445bf4 100755
--- a/check.py
+++ b/check.py
@@ -18,12 +18,17 @@ import os, shutil, sys, subprocess, difflib, json, time
interpreter = None
requested = []
+torture = True
for arg in sys.argv[1:]:
if arg.startswith('--interpreter='):
interpreter = arg.split('=')[1]
print '[ using wasm interpreter at "%s" ]' % interpreter
assert os.path.exists(interpreter), 'interpreter not found'
+ elif arg == '--torture':
+ torture = True
+ elif arg == '--no-torture':
+ torture = False
else:
requested.append(arg)
@@ -85,7 +90,9 @@ for asm in tests:
if asm.endswith('.asm.js'):
wasm = asm.replace('.asm.js', '.fromasm')
print '..', asm, wasm
- actual, err = subprocess.Popen([os.path.join('bin', 'asm2wasm'), os.path.join('test', asm)], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
+ cmd = [os.path.join('bin', 'asm2wasm'), os.path.join('test', asm)]
+ print ' ', ' '.join(cmd)
+ actual, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
assert err == '', 'bad err:' + err
# verify output
@@ -254,22 +261,34 @@ for dot_s_dir in ['dot_s', 'llvm_autogenerated']:
actual, err = proc.communicate()
assert proc.returncode == 0, err
-print '\n[ checking torture testcases... ]\n'
-
-import test.waterfall.src.link_assembly_files as link_assembly_files
-s2wasm_torture_out = os.path.abspath(os.path.join('test', 's2wasm-torture-out'))
-if os.path.isdir(s2wasm_torture_out):
+if torture:
+
+ print '\n[ checking torture testcases... ]\n'
+
+ import test.waterfall.src.link_assembly_files as link_assembly_files
+ s2wasm_torture_out = os.path.abspath(os.path.join('test', 's2wasm-torture-out'))
+ if os.path.isdir(s2wasm_torture_out):
+ shutil.rmtree(s2wasm_torture_out)
+ os.mkdir(s2wasm_torture_out)
+ unexpected_result_count = link_assembly_files.run(
+ linker=os.path.abspath(os.path.join('bin', 's2wasm')),
+ files=os.path.abspath(os.path.join('test', 'torture-s', '*.s')),
+ fails=os.path.abspath(os.path.join('test', 's2wasm_known_gcc_test_failures.txt')),
+ out=s2wasm_torture_out)
+ assert os.path.isdir(s2wasm_torture_out), 'Expected output directory %s' % s2wasm_torture_out
shutil.rmtree(s2wasm_torture_out)
-os.mkdir(s2wasm_torture_out)
-unexpected_result_count = link_assembly_files.run(
- linker=os.path.abspath(os.path.join('bin', 's2wasm')),
- files=os.path.abspath(os.path.join('test', 'torture-s', '*.s')),
- fails=os.path.abspath(os.path.join('test', 's2wasm_known_gcc_test_failures.txt')),
- out=s2wasm_torture_out)
-assert os.path.isdir(s2wasm_torture_out), 'Expected output directory %s' % s2wasm_torture_out
-shutil.rmtree(s2wasm_torture_out)
-if unexpected_result_count:
- fail(unexpected_result_count, 0)
+ if unexpected_result_count:
+ fail(unexpected_result_count, 0)
+
+print '\n[ checking wasm-as testcases... ]\n'
+
+for wast in tests:
+ if wast.endswith('.wast') and not wast in ['unit.wast']: # blacklist some known failures
+ cmd = [os.path.join('bin', 'wasm-as'), os.path.join('test', wast), '-o', 'a.wasm']
+ print cmd
+ if os.path.exists('a.wasm'): os.unlink('a.wasm')
+ subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ assert os.path.exists('a.wasm')
print '\n[ checking example testcases... ]\n'