rust-bitcoin-unsafe-fast/fuzz/fuzz.sh

35 lines
826 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -ex
REPO_DIR=$(git rev-parse --show-toplevel)
# shellcheck source=./fuzz-util.sh
source "$REPO_DIR/fuzz/fuzz-util.sh"
# Check that input files are correct Windows file names
checkWindowsFiles
2022-08-30 20:22:47 +00:00
if [ "$1" == "" ]; then
targetFiles="$(listTargetFiles)"
2022-08-30 20:22:47 +00:00
else
targetFiles=fuzz_targets/"$1".rs
2022-08-30 20:22:47 +00:00
fi
cargo --version
rustc --version
# Testing
2022-08-30 17:19:39 +00:00
cargo install --force honggfuzz --no-default-features
for targetFile in $targetFiles; do
targetName=$(targetFileToName "$targetFile")
echo "Fuzzing target $targetName ($targetFile)"
if [ -d "hfuzz_input/$targetName" ]; then
HFUZZ_INPUT_ARGS="-f hfuzz_input/$targetName/input\""
else
HFUZZ_INPUT_ARGS=""
fi
HFUZZ_RUN_ARGS="--run_time 30 --exit_upon_crash -v $HFUZZ_INPUT_ARGS" cargo hfuzz run "$targetName"
checkReport "$targetName"
2018-03-20 16:28:18 +00:00
done