diff --git a/Makefile b/Makefile index 7e42d79edf5..0a253551404 100644 --- a/Makefile +++ b/Makefile @@ -256,14 +256,6 @@ doc: -p pallet-gear-program -p pallet-gear-rpc-runtime-api -p pallet-gear-rpc -p pallet-gear-scheduler -p gsdk @ cp -f images/logo.svg target/doc/rust-logo.svg -.PHONY: fuzz -fuzz: - @ ./scripts/gear.sh test fuzz $(target) - -.PHONY: fuzz-vara #TODO 2434 test it works -fuzz-vara: - @ ./scripts/gear.sh test fuzz --features=vara-native,lazy-pages --no-default-features $(target) - .PHONY: kill-gear kill: @ pkill -f 'gear |gear$' -9 diff --git a/scripts/check-fuzzer.sh b/scripts/check-fuzzer.sh index a7a9d4a37e8..fff3839e853 100755 --- a/scripts/check-fuzzer.sh +++ b/scripts/check-fuzzer.sh @@ -8,7 +8,7 @@ main() { dd if=/dev/urandom of=utils/runtime-fuzzer/fuzz/corpus/main/check-fuzzer-bytes bs=1 count=27000000 echo " >> Running fuzzer with failpoint" - RUST_BACKTRACE=1 FAILPOINTS=fail_fuzzer=return ./scripts/gear.sh test fuzz > fuzz_run 2>&1 + RUST_BACKTRACE=1 FAILPOINTS=fail_fuzzer=return ./scripts/gear.sh test fuzz "" wlogs > fuzz_run 2>&1 echo " >> Checking fuzzer output" if cat fuzz_run | grep -qzP '(?s)(?=.*GasTree corrupted)(?=.*NodeAlreadyExists)(?=.*\Qpallet_gear::pallet::Pallet>::consume_and_retrieve\E)' ; then diff --git a/scripts/gear.sh b/scripts/gear.sh index a7e2ebc1d55..e74c01c7145 100755 --- a/scripts/gear.sh +++ b/scripts/gear.sh @@ -299,7 +299,7 @@ case "$COMMAND" in fuzz) header "Running fuzzer for runtime panic checks" - run_fuzzer "$ROOT_DIR" "$1"; ;; + run_fuzzer "$ROOT_DIR" "$1" "$2"; ;; fuzz-repr) header "Running fuzzer reproduction" diff --git a/scripts/src/test.sh b/scripts/src/test.sh index 07272ce15e9..aa51385bfc8 100755 --- a/scripts/src/test.sh +++ b/scripts/src/test.sh @@ -20,7 +20,9 @@ test_usage() { gcli run gcli package tests pallet run pallet-gear tests client run client tests via gclient - fuzz run fuzzer with a fuzz target + fuzz run fuzzer + The scripts accepts a path to corpus dir as a first param, + and a "wlogs" flag to enable logs while fuzzing. fuzz-repr run fuzzer reproduction test syscalls run syscalls integrity test in benchmarking module of pallet-gear docs run doc tests @@ -85,9 +87,14 @@ run_fuzzer() { # Navigate to fuzzer dir cd $ROOT_DIR/utils/runtime-fuzzer + if [ "$3" = "wlogs" ]; then + LOG_TARGETS="debug,syscalls,gear_wasm_gen=trace,runtime_fuzzer=trace,gear_backend_common=trace" + else + LOG_TARGETS="off" + fi + # Run fuzzer - RUST_LOG=debug,syscalls,gear_wasm_gen=trace,runtime_fuzzer=trace,gear_backend_common=trace \ - cargo fuzz run --release --sanitizer=none main $CORPUS_DIR -- -rss_limit_mb=8192 -max_len=35000000 -len_control=0 + RUST_LOG="$LOG_TARGETS" cargo fuzz run --release --sanitizer=none main $CORPUS_DIR -- -rss_limit_mb=8192 -max_len=35000000 -len_control=0 } test_fuzzer_reproduction() {