forked from lightningdevkit/rust-lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci-fuzz.sh
executable file
·43 lines (39 loc) · 1.07 KB
/
ci-fuzz.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
set -e
set -x
pushd src/msg_targets
rm msg_*.rs
./gen_target.sh
[ "$(git diff)" != "" ] && exit 1
popd
pushd src/bin
rm *_target.rs
./gen_target.sh
[ "$(git diff)" != "" ] && exit 1
popd
cargo install --color always --force honggfuzz --no-default-features
sed -i 's/lto = true//' Cargo.toml
export RUSTFLAGS="--cfg=secp256k1_fuzz --cfg=hashes_fuzz"
export HFUZZ_BUILD_ARGS="--features honggfuzz_fuzz"
cargo --color always hfuzz build
for TARGET in src/bin/*.rs; do
FILENAME=$(basename $TARGET)
FILE="${FILENAME%.*}"
HFUZZ_RUN_ARGS="--exit_upon_crash -v -n2"
if [ "$FILE" = "chanmon_consistency_target" ]; then
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -F 64 -N100000"
elif [ "$FILE" = "full_stack_target" ]; then
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N1000000"
else
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
fi
export HFUZZ_RUN_ARGS
cargo --color always hfuzz run $FILE
if [ -f hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT ]; then
cat hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT
for CASE in hfuzz_workspace/$FILE/SIG*; do
cat $CASE | xxd -p
done
exit 1
fi
done