get fuzzing options from directory
This commit is contained in:
parent
f505d64c50
commit
a17951bfa8
|
@ -7,7 +7,12 @@ CONFIGURE_FLAGS="--enable-tests=no --enable-fuzz-main"
|
||||||
ZCUTIL=$(realpath "./zcutil")
|
ZCUTIL=$(realpath "./zcutil")
|
||||||
export AFL_LOG_DIR="$(pwd)"
|
export AFL_LOG_DIR="$(pwd)"
|
||||||
|
|
||||||
FUZZ_OPTIONS_STRING="Options are: CheckBlock, DecodeHexTx, DeserializeAddrMan, DeserializeTx or ReadFeeEstimates"
|
for d in src/fuzzing/*/ ; do
|
||||||
|
fuzz_cases+="$(basename "$d"), "
|
||||||
|
fuzz_cases_choices=("${fuzz_cases_choices[@]}" $(basename "$d"))
|
||||||
|
done
|
||||||
|
|
||||||
|
FUZZ_OPTIONS_STRING="Options are: ${fuzz_cases::-2}"
|
||||||
|
|
||||||
required_options_count=0
|
required_options_count=0
|
||||||
DEFAULT_BUILD_CC="CC=$ZCUTIL/afl/zcash-wrapper-gcc"
|
DEFAULT_BUILD_CC="CC=$ZCUTIL/afl/zcash-wrapper-gcc"
|
||||||
|
@ -17,6 +22,7 @@ function help {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
A wrapper around ./zcutil/build.sh for instrumenting the build with AFL.
|
A wrapper around ./zcutil/build.sh for instrumenting the build with AFL.
|
||||||
You may obtain a copy of AFL using ./zcutil/afl/afl-get.sh.
|
You may obtain a copy of AFL using ./zcutil/afl/afl-get.sh.
|
||||||
|
This script must be run from within the top level directory of a zcash clone.
|
||||||
Additional arguments are passed-through to build.sh.
|
Additional arguments are passed-through to build.sh.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
@ -85,12 +91,10 @@ if ((required_options_count < 2)); then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $FUZZ_CASE in
|
if ! [[ "${fuzz_cases_choices[*]} " == *" $FUZZ_CASE "* ]]; then
|
||||||
CheckBlock|DecodeHexTx|DeserializeAddrMan|DeserializeTx|ReadFeeEstimates);;
|
echo "fuzz case option is invalid. ($FUZZ_OPTIONS_STRING)"
|
||||||
*) echo "fuzz case option is invalid. ($FUZZ_OPTIONS_STRING)"
|
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
|
|
||||||
cp "./src/fuzzing/$FUZZ_CASE/fuzz.cpp" src/fuzz.cpp
|
cp "./src/fuzzing/$FUZZ_CASE/fuzz.cpp" src/fuzz.cpp
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,18 @@
|
||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
FUZZ_OPTIONS_STRING="Where FUZZ_CASE is one of the following: CheckBlock, DecodeHexTx, DeserializeAddrMan, DeserializeTx or ReadFeeEstimates"
|
for d in src/fuzzing/*/ ; do
|
||||||
|
fuzz_cases+="$(basename "$d"), "
|
||||||
|
done
|
||||||
|
|
||||||
|
FUZZ_OPTIONS_STRING="Where FUZZ_CASE is one of the following: ${fuzz_cases::-2}"
|
||||||
|
|
||||||
required_options_count=0
|
required_options_count=0
|
||||||
|
|
||||||
function help {
|
function help {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Obtains and builds a copy of AFL from source.
|
Obtains and builds a copy of AFL from source.
|
||||||
|
This script must be run from within the top level directory of a zcash clone.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
$0 --afl-install=AFL_INSTALL_DIR
|
$0 --afl-install=AFL_INSTALL_DIR
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
FUZZ_OPTIONS_STRING="Options are: CheckBlock, DecodeHexTx, DeserializeAddrMan, DeserializeTx or ReadFeeEstimates"
|
for d in src/fuzzing/*/ ; do
|
||||||
|
fuzz_cases+="$(basename "$d"), "
|
||||||
|
done
|
||||||
|
|
||||||
|
FUZZ_OPTIONS_STRING="Options are: ${fuzz_cases::-2}"
|
||||||
|
|
||||||
required_options_count=0
|
required_options_count=0
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,18 @@
|
||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
FUZZ_OPTIONS_STRING="Options are: CheckBlock, DecodeHexTx, DeserializeAddrMan, DeserializeTx or ReadFeeEstimates"
|
for d in src/fuzzing/*/ ; do
|
||||||
|
fuzz_cases+="$(basename "$d"), "
|
||||||
|
done
|
||||||
|
|
||||||
|
FUZZ_OPTIONS_STRING="Options are: ${fuzz_cases::-2}"
|
||||||
|
|
||||||
required_options_count=0
|
required_options_count=0
|
||||||
|
|
||||||
function help {
|
function help {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Start fuzzing a case in a previously zcashd built for AFL.
|
Start fuzzing a case in a previously zcashd built for AFL.
|
||||||
|
This script must be run from within the top level directory of a zcash clone.
|
||||||
Additional arguments are passed-through to AFL.
|
Additional arguments are passed-through to AFL.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
Loading…
Reference in New Issue