summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-05-17 11:13:33 -0700
committerGitHub <noreply@github.com>2022-05-17 11:13:33 -0700
commite74f9e1681d37f5d13dc1025799611ca6d65bbfd (patch)
tree549f93d97dffe2f198e94d1372ffbe043f56a905
parentf81fcd92557e6389d719b7d63f845434810a91fe (diff)
downloadbinaryen-e74f9e1681d37f5d13dc1025799611ca6d65bbfd.tar.gz
binaryen-e74f9e1681d37f5d13dc1025799611ca6d65bbfd.tar.bz2
binaryen-e74f9e1681d37f5d13dc1025799611ca6d65bbfd.zip
Fuzzer: Show a clear error if a given wasm fails to run (#4672)
Without this the error from a bad given wasm file - either by the user, or during a reduction where smaller wasms are given - could be very confusing. A bad given wasm file during reduction, in particular, indicates a bug in the reducer most likely.
-rwxr-xr-xscripts/fuzz_opt.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py
index 696ccc4bd..8ef4df334 100755
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -1048,7 +1048,11 @@ def test_one(random_input, given_wasm):
# apply properties like not having any NaNs, which the original fuzz
# wasm had applied. that is, we need to preserve properties like not
# having nans through reduction.
- run([in_bin('wasm-opt'), given_wasm, '-o', 'a.wasm'] + FUZZ_OPTS + FEATURE_OPTS)
+ try:
+ run([in_bin('wasm-opt'), given_wasm, '-o', 'a.wasm'] + FUZZ_OPTS + FEATURE_OPTS)
+ except Exception as e:
+ print("Internal error in fuzzer! Could not run given wasm")
+ raise e
else:
# emit the target features section so that reduction can work later,
# without needing to specify the features