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