summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-08-09 13:13:47 -0700
committerGitHub <noreply@github.com>2022-08-09 13:13:47 -0700
commit67023db726900f5581d0684fce68226e7875dbdd (patch)
tree67e2635570987e72a1a2ebd86e65d540163738f3 /scripts
parent5df39e3bbddaefcb0d0c4d1f10412c508b120aca (diff)
downloadbinaryen-67023db726900f5581d0684fce68226e7875dbdd.tar.gz
binaryen-67023db726900f5581d0684fce68226e7875dbdd.tar.bz2
binaryen-67023db726900f5581d0684fce68226e7875dbdd.zip
Fuzzer: Add some docs and error handling" (#4887)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/fuzz_opt.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py
index bb25dd808..4543ef1ff 100755
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -1,12 +1,19 @@
#!/usr/bin/python3
'''
-Runs random passes and options on random inputs, using wasm-opt.
+Run various fuzzing operations on random inputs, using wasm-opt. See
+"testcase_handlers" below for the list of fuzzing operations.
-Can be configured to run just wasm-opt itself (using --fuzz-exec)
-or also run VMs on it.
+Usage:
-For afl-fuzz integration, you probably don't want this, and can use
+./scripts/fuzz_opt.py
+
+That will run forever or until it finds a problem.
+
+Setup: Some tools are optional, like emcc and wasm2c. The v8 shell (d8),
+however, is used in various sub-fuzzers and so it is mandatory.
+
+Note: For afl-fuzz integration, you probably don't want this, and can use
something like
BINARYEN_CORES=1 BINARYEN_PASS_DEBUG=1 afl-fuzz -i afl-testcases/ -o afl-findings/ -m 100 -d -- bin/wasm-opt -ttf --fuzz-exec --Os @@
@@ -1280,6 +1287,14 @@ IMPLIED_FEATURE_OPTS = {
'--disable-reference-types': ['--disable-gc']
}
+print('''
+<<< fuzz_opt.py >>>
+''')
+
+if not shared.V8:
+ print('The v8 shell, d8, must be in the path')
+ sys.exit(1)
+
if __name__ == '__main__':
# if we are given a seed, run exactly that one testcase. otherwise,
# run new ones until we fail