diff --git a/internal/integration_test/fuzz/README.md b/internal/integration_test/fuzz/README.md index d78179aa..cf1e6889 100644 --- a/internal/integration_test/fuzz/README.md +++ b/internal/integration_test/fuzz/README.md @@ -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`, diff --git a/internal/integration_test/fuzz/predicate.sh b/internal/integration_test/fuzz/predicate.sh new file mode 100755 index 00000000..de376eed --- /dev/null +++ b/internal/integration_test/fuzz/predicate.sh @@ -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 $((! $?))