mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

All changes in this patch were performed automatically with `shfmt` with configuration flags specified in `.pre-commit-config.yaml`. In addition to fixing whitespace the roundtrip through shfmt's AST also transforms command substitutions `cmd` # becomes $(cmd) and some redirects >&2 echo "msg" # becomes echo >&2 "msg"
39 lines
1 KiB
Bash
Executable file
39 lines
1 KiB
Bash
Executable file
#! /usr/bin/env bash
|
|
|
|
result=0
|
|
|
|
echo "Testing fuzzers against their seed corpus"
|
|
echo "-----------------------------------------"
|
|
|
|
cd build || result=1
|
|
. ./zeek-path-dev.sh
|
|
|
|
fuzzers=$(find ./src/fuzzers -name 'zeek-*-fuzzer')
|
|
|
|
for fuzzer_path in ${fuzzers}; do
|
|
fuzzer_exe=$(basename ${fuzzer_path})
|
|
fuzzer_name=$(echo ${fuzzer_exe} | sed 's/zeek-\(.*\)-fuzzer/\1/g')
|
|
corpus="../src/fuzzers/${fuzzer_name}-corpus.zip"
|
|
|
|
if [[ -e ${corpus} ]]; then
|
|
echo "Fuzzer: ${fuzzer_exe} ${corpus}"
|
|
(rm -rf corpus && mkdir corpus) || result=1
|
|
(cd corpus && unzip ../${corpus} >/dev/null) || result=1
|
|
${fuzzer_path} corpus/* >${fuzzer_exe}.out 2>${fuzzer_exe}.err
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
tail -n 1 ${fuzzer_exe}.out
|
|
else
|
|
result=1
|
|
cat ${fuzzer_exe}.out
|
|
echo " FAILED"
|
|
cat ${fuzzer_exe}.err
|
|
fi
|
|
else
|
|
echo "Skipping Fuzzer (no corpus): ${fuzzer_exe}"
|
|
fi
|
|
|
|
echo "-----------------------------------------"
|
|
done
|
|
|
|
exit ${result}
|