summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'check.py')
-rwxr-xr-xcheck.py71
1 files changed, 26 insertions, 45 deletions
diff --git a/check.py b/check.py
index 0ccad611e..64a6914ff 100755
--- a/check.py
+++ b/check.py
@@ -191,26 +191,6 @@ for t in spec_tests:
if actual != expected:
fail(actual, expected)
-print '\n[ checking binaryen-shell experimental testcases... ]\n'
-
-if len(requested) == 0:
- BLACKLIST = ['call.wast', # bad indirect_call, no type
- 'cfg-stackify.wast', # call an import $ which no return value, but in a context with a return value
- 'inline-asm.wast', # there is a (foo ..) s-expression block, perhaps inline asm? not a valid s-expression
- 'switch.wast', # bad tableswitch, no (table ..) inside it
- ]
- experimental_tests = [os.path.join('experimental', 'prototype-wasmate', 'test', 'expected-output', t) for t in sorted(os.listdir(os.path.join('test', 'experimental', 'prototype-wasmate', 'test', 'expected-output'))) if t not in BLACKLIST]
-else:
- experimental_tests = requested[:]
-
-for t in experimental_tests:
- if t.startswith('experimental') and t.endswith('.wast'):
- print '..', t
- wast = os.path.join('test', t)
- proc = subprocess.Popen([os.path.join('bin', 'binaryen-shell'), wast], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- actual, err = proc.communicate()
- assert proc.returncode == 0, err
-
print '\n[ checking wasm2asm testcases... ]\n'
for wasm in tests + [os.path.join('spec', name) for name in ['address.wast']]:#spec_tests:
@@ -248,32 +228,33 @@ for wasm in tests + [os.path.join('spec', name) for name in ['address.wast']]:#s
print '\n[ checking .s testcases... ]\n'
-for s in sorted(os.listdir(os.path.join('test', 'dot_s'))) + sorted(os.listdir(os.path.join('test', 'experimental', 'prototype-wasmate', 'test'))):
- if not s.endswith('.s'): continue
- if s in ['inline-asm.s', # what is this?
- 'offset-folding.s' # unresolved symbol x
- ]: continue
- print '..', s
- wasm = s.replace('.s', '.wast')
- full = os.path.join('test', 'dot_s', s)
- if not os.path.exists(full):
- full = os.path.join('test', 'experimental', 'prototype-wasmate', 'test', s)
- actual, err = subprocess.Popen([os.path.join('bin', 's2wasm'), full], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
- assert err == '', 'bad err:' + err
-
- # verify output
- expected_file = os.path.join('test', 'dot_s', wasm)
- if not os.path.exists(expected_file):
- print actual
- raise Exception('output ' + expected_file + ' does not exist')
- expected = open(expected_file).read()
- if actual != expected:
- fail(actual, expected)
+for dot_s_dir in ['dot_s', 'llvm_autogenerated']:
+ for s in sorted(os.listdir(os.path.join('test', dot_s_dir))):
+ if not s.endswith('.s'): continue
+ print '..', s
+ wasm = s.replace('.s', '.wast')
+ full = os.path.join('test', dot_s_dir, s)
+ actual, err = subprocess.Popen([os.path.join('bin', 's2wasm'), full], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
+ assert err == '', 'bad err:' + err
- # verify with options
- proc = subprocess.Popen([os.path.join('bin', 's2wasm'), full, '--global-base=1024'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- out, err = proc.communicate()
- assert proc.returncode == 0, err
+ # verify output
+ expected_file = os.path.join('test', dot_s_dir, wasm)
+ if not os.path.exists(expected_file):
+ print actual
+ raise Exception('output ' + expected_file + ' does not exist')
+ expected = open(expected_file).read()
+ if actual != expected:
+ fail(actual, expected)
+
+ # verify with options
+ proc = subprocess.Popen([os.path.join('bin', 's2wasm'), full, '--global-base=1024'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = proc.communicate()
+ assert proc.returncode == 0, err
+
+ # run binaryen-shell on the .wast to verify that it parses
+ proc = subprocess.Popen([os.path.join('bin', 'binaryen-shell'), expected_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ actual, err = proc.communicate()
+ assert proc.returncode == 0, err
print '\n[ checking torture testcases... ]\n'