summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-05-20 10:50:02 -0700
committerGitHub <noreply@github.com>2017-05-20 10:50:02 -0700
commit9e0958982d2044949746c2d8290dbc0368546ebf (patch)
tree40baee2d19419d76ff904b79b6146be980d5b287 /check.py
parent2ddb7cb1f45cf9aeef90ec5c8000a2d279f0302b (diff)
downloadbinaryen-9e0958982d2044949746c2d8290dbc0368546ebf.tar.gz
binaryen-9e0958982d2044949746c2d8290dbc0368546ebf.tar.bz2
binaryen-9e0958982d2044949746c2d8290dbc0368546ebf.zip
afl-fuzz bug fixes (#1018)
* values cannot flow through an if without an else, they never return a value * check pass tests in pass-debug mode too * add missing finalization in binary reading
Diffstat (limited to 'check.py')
-rwxr-xr-xcheck.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/check.py b/check.py
index 345a3b302..35f5bb628 100755
--- a/check.py
+++ b/check.py
@@ -85,10 +85,24 @@ for t in sorted(os.listdir(os.path.join(options.binaryen_test, 'passes'))):
assert len(asserts) == 0
with open('split.wast', 'w') as o: o.write(module)
cmd = WASM_OPT + opts + ['split.wast', '--print']
- actual += run_command(cmd)
+ curr = run_command(cmd)
+ actual += curr
# also check debug mode output is valid
debugged = run_command(cmd + ['--debug'], stderr=subprocess.PIPE)
fail_if_not_contained(actual, debugged)
+ # also check pass-debug mode
+ old_pass_debug = os.environ.get('BINARYEN_PASS_DEBUG')
+ try:
+ os.environ['BINARYEN_PASS_DEBUG'] = '1'
+ pass_debug = run_command(cmd)
+ fail_if_not_identical(curr, pass_debug)
+ finally:
+ if old_pass_debug is not None:
+ os.environ['BINARYEN_PASS_DEBUG'] = old_pass_debug
+ else:
+ if 'BINARYEN_PASS_DEBUG' in os.environ:
+ del os.environ['BINARYEN_PASS_DEBUG']
+
fail_if_not_identical(actual, open(os.path.join('test', 'passes', passname + ('.bin' if binary else '') + '.txt'), 'rb').read())
print '[ checking asm2wasm testcases... ]\n'