summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-06-02 14:22:25 -0700
committerGitHub <noreply@github.com>2020-06-02 14:22:25 -0700
commit88fcf614c69c64691df9101192e277629e9ca124 (patch)
tree3a324d8d7faa59134a74f42f98349c33842a54f2
parentcb6b1a1f8c17341ca2e8c0f552b24b455f7e2c3b (diff)
downloadbinaryen-88fcf614c69c64691df9101192e277629e9ca124.tar.gz
binaryen-88fcf614c69c64691df9101192e277629e9ca124.tar.bz2
binaryen-88fcf614c69c64691df9101192e277629e9ca124.zip
Fuzzing: Run --denan etc. even on a given wasm (#2887)
When the fuzzer script is given a wasm we don't create a new one from scratch. But we should still apply --denan and other things so that we preserve those properties while reducing. Without this it's possible for reduction to start with a wasm with no nans but to lose the property eventually, and end up with a reduced testcase which is not quite what you want.
-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 ac6ba977a..9e644598e 100755
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -589,7 +589,11 @@ def test_one(random_input, opts, given_wasm):
print()
if given_wasm:
- shutil.copyfile(given_wasm, 'a.wasm')
+ # if given a wasm file we want to use it as is, but we also want to
+ # 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)
else:
# emit the target features section so that reduction can work later,
# without needing to specify the features