1#!/usr/bin/env bash 2 3set -eux 4cd $(dirname $0)/.. 5 6export CARGO_TARGET_DIR=$(pwd)/target 7 8pushd ./example 9cargo rustc \ 10 --release \ 11 -- \ 12 -Cpasses='sancov' \ 13 -Cllvm-args=-sanitizer-coverage-level=3 \ 14 -Cllvm-args=-sanitizer-coverage-trace-compares \ 15 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters \ 16 -Cllvm-args=-sanitizer-coverage-stack-depth \ 17 -Cllvm-args=-sanitizer-coverage-trace-geps \ 18 -Cllvm-args=-sanitizer-coverage-prune-blocks=0 \ 19 -Zsanitizer=address 20(! $CARGO_TARGET_DIR/release/example -runs=100000) 21popd 22 23pushd ./example_arbitrary 24cargo rustc \ 25 --release \ 26 -- \ 27 -Cpasses='sancov' \ 28 -Cllvm-args=-sanitizer-coverage-level=3 \ 29 -Cllvm-args=-sanitizer-coverage-trace-compares \ 30 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters \ 31 -Cllvm-args=-sanitizer-coverage-stack-depth \ 32 -Cllvm-args=-sanitizer-coverage-trace-geps \ 33 -Cllvm-args=-sanitizer-coverage-prune-blocks=0 \ 34 -Zsanitizer=address 35(! $CARGO_TARGET_DIR/release/example_arbitrary -runs=10000000) 36RUST_LIBFUZZER_DEBUG_PATH=$(pwd)/debug_output \ 37 $CARGO_TARGET_DIR/release/example_arbitrary \ 38 $(ls ./crash-* | head -n 1) 39cat $(pwd)/debug_output 40grep -q Rgb $(pwd)/debug_output 41popd 42