mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 14:54:26 +01:00
fuzz: add check-fuzz.sh
The script runs each fuzz target on its seed corpus and prints any failures.
This commit is contained in:
committed by
Rusty Russell
parent
a1a1373090
commit
fa988d2942
36
tests/fuzz/check-fuzz.sh
Executable file
36
tests/fuzz/check-fuzz.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
# Runs each fuzz target on its seed corpus and prints any failures.
|
||||
|
||||
readonly FUZZ_DIR=$(dirname "$0")
|
||||
readonly TARGETS=$(find "${FUZZ_DIR}" -type f -name "fuzz-*" ! -name "*.*")
|
||||
|
||||
export UBSAN_OPTIONS="halt_on_error=1:print_stacktrace=1"
|
||||
|
||||
passes=0
|
||||
fails=0
|
||||
for t in ${TARGETS}; do
|
||||
target_name=$(basename "${t}")
|
||||
corpus_dir="${FUZZ_DIR}/corpora/${target_name}/"
|
||||
cmd="${t} -runs=0 ${corpus_dir}"
|
||||
|
||||
echo -n "Checking ${target_name}... "
|
||||
if output=$(${cmd} 2>&1); then
|
||||
echo "PASS"
|
||||
passes=$((passes + 1))
|
||||
else
|
||||
echo "FAIL"
|
||||
echo
|
||||
echo "Failing command: ${cmd}"
|
||||
echo "Output:"
|
||||
echo "${output}"
|
||||
echo
|
||||
fails=$((fails + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "TOTAL PASSED: ${passes}"
|
||||
echo "TOTAL FAILED: ${fails}"
|
||||
|
||||
exit ${fails}
|
||||
Reference in New Issue
Block a user