fuzz: adds support for minimization via wasm-tools shrink (#1844)

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
Takeshi Yoneda
2023-11-23 08:29:10 +09:00
committed by GitHub
parent b4c1f26232
commit 17427e60e9
2 changed files with 22 additions and 0 deletions

View File

@@ -80,6 +80,16 @@ Minimize test case with:
and you can use that command to "minimize" the input binary while keeping the same error.
Alternatively, you can use the following command to minimize the arbitrary input binary:
```
go test -c ./wazerolib -o nodiff.test && wasm-tools shrink ./predicate.sh original.{wasm,wat} -o shrinken.wasm --attempts 4294967295
```
which uses `wasm-tools shrinken` command to minimize the input binary. Internally, the `predicate.sh` is invoked for each input binary
where it executes the `nodiff.test` binary which runs `TestReRunFailedRequireNoDiffCase`.
### Run fuzzing on wazevo
Until we replace the existing compiler with the new optimizing compiler `wazevo`,

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# The Wasm file is given as the first and only argument to the script.
WASM=$1
echo "Testing $WASM"
export WASM_BINARY_PATH=$WASM
# Run the test and reverse the exit code so that a non-zero exit code indicates interesting case.
./nodiff.test
exit $((! $?))