
* Add ccache * Update codecov.yml * Update build_and_test.yml * Update build_and_test.yml * Update test_all_fuzzers.sh Add fuzzer timer * Fix `./test_all_fuzzers.sh` on macos * Fix CI * Fix CI * Update build_and_test.yml * Fix typo
53 lines
1.4 KiB
Bash
Executable File
53 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
cd "$SCRIPT_DIR/.."
|
|
|
|
# TODO: This should be rewritten in rust, a Makefile, or some platform-independent language
|
|
|
|
fuzzers=$(find ./fuzzers -maxdepth 1 -type d)
|
|
backtrace_fuzzers=$(find ./fuzzers/backtrace_baby_fuzzers -maxdepth 1 -type d)
|
|
|
|
libafl=$(pwd)
|
|
|
|
git submodule init && git submodule update
|
|
|
|
# record time of each fuzzer
|
|
declare -A time_record || (echo "declare -A not avaliable, please update your bash version to 4";exit 1)
|
|
for fuzzer in $(echo $fuzzers $backtrace_fuzzers);
|
|
do
|
|
cd $fuzzer
|
|
start=`date +%s`
|
|
# Clippy checks
|
|
if [ "$1" != "--no-fmt" ]; then
|
|
|
|
echo "[*] Checking fmt for $fuzzer"
|
|
cargo fmt --all -- --check || exit 1
|
|
echo "[*] Running clippy for $fuzzer"
|
|
cargo clippy || exit 1
|
|
else
|
|
echo "[+] Skipping fmt and clippy for $fuzzer (--no-fmt specified)"
|
|
fi
|
|
|
|
if [ -e ./Makefile.toml ]; then
|
|
echo "[*] Testing $fuzzer"
|
|
cargo make test || exit 1
|
|
echo "[+] Done testing $fuzzer"
|
|
else
|
|
echo "[*] Building $fuzzer"
|
|
cargo build || exit 1
|
|
echo "[+] Done building $fuzzer"
|
|
fi
|
|
end=`date +%s`
|
|
time_record[$fuzzer]=$((end-start))
|
|
# Save disk space
|
|
cargo clean
|
|
cd $libafl
|
|
echo ""
|
|
done
|
|
|
|
# print time for each fuzzer
|
|
for key in ${!time_record[@]}; do
|
|
echo "dir:"$key" time:"${time_record[$key]};
|
|
done
|