]> git.bitcoin.ninja Git - rust-lightning/blob - fuzz/ci-fuzz.sh
Add #[allow(unused_mut)] on reorg_test as older rustc requires mut
[rust-lightning] / fuzz / ci-fuzz.sh
1 #!/bin/bash
2 set -e
3 set -x
4
5 pushd src/msg_targets
6 rm msg_*.rs
7 ./gen_target.sh
8 [ "$(git diff)" != "" ] && exit 1
9 popd
10 pushd src/bin
11 rm *_target.rs
12 ./gen_target.sh
13 [ "$(git diff)" != "" ] && exit 1
14 popd
15
16 cargo install --color always --force honggfuzz
17 sed -i 's/lto = true//' Cargo.toml
18 HFUZZ_BUILD_ARGS="--features honggfuzz_fuzz" cargo --color always hfuzz build
19 for TARGET in src/bin/*.rs; do
20         FILENAME=$(basename $TARGET)
21         FILE="${FILENAME%.*}"
22         HFUZZ_RUN_ARGS="--exit_upon_crash -v -n2"
23         if [ "$FILE" = "chanmon_consistency_target" ]; then
24                 HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -F 64 -N100000"
25         elif [ "$FILE" = "full_stack_target" ]; then
26                 HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -t0 -N1000000"
27         else
28                 HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -N1000000"
29         fi
30         export HFUZZ_RUN_ARGS
31         HFUZZ_BUILD_ARGS="--features honggfuzz_fuzz" cargo --color always hfuzz run $FILE
32         if [ -f hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT ]; then
33                 cat hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT
34                 for CASE in hfuzz_workspace/$FILE/SIG*; do
35                         cat $CASE | xxd -p
36                 done
37                 exit 1
38         fi
39 done