Skip to content

Commit 80434c9

Browse files
committed
delete_nonreduced_fuzz_inputs: switch to cmake
1 parent e1c91d3 commit 80434c9

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

delete_nonreduced_fuzz_inputs.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export DEBIAN_FRONTEND=noninteractive
1818
apt update
1919
apt install -y \
2020
git \
21-
build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 \
21+
build-essential pkg-config bsdmainutils python3 cmake \
2222
libsqlite3-dev libevent-dev libboost-dev \
2323
lsb-release wget software-properties-common gnupg
2424

@@ -43,21 +43,22 @@ git clone --depth=1 https://github.com/bitcoin/bitcoin.git
4343
(
4444
cd bitcoin
4545

46-
./autogen.sh
47-
4846
echo "Adding reduced seeds with afl-cmin"
4947

50-
./configure LDFLAGS="-fuse-ld=lld" CC=afl-clang-fast CXX=afl-clang-fast++ --enable-fuzz
51-
make clean
52-
make -j $(nproc)
48+
rm -rf build_fuzz/
49+
export LDFLAGS="-fuse-ld=lld"
50+
cmake -B build_fuzz \
51+
-DCMAKE_C_COMPILER=afl-clang-fast -DCMAKE_CXX_COMPILER=afl-clang-fast++ \
52+
-DBUILD_FOR_FUZZING=ON
53+
cmake --build build_fuzz -j$(nproc)
5354

54-
WRITE_ALL_FUZZ_TARGETS_AND_ABORT="/tmp/a" "./src/test/fuzz/fuzz" || true
55+
WRITE_ALL_FUZZ_TARGETS_AND_ABORT="/tmp/a" "./build_fuzz/src/test/fuzz/fuzz" || true
5556
readarray FUZZ_TARGETS < "/tmp/a"
5657
for fuzz_target in ${FUZZ_TARGETS[@]}; do
5758
if [ -d "../all_inputs/$fuzz_target" ]; then
5859
mkdir --parents ../qa-assets/"${FUZZ_INPUTS_DIR}"/$fuzz_target
5960
# Allow timeouts and crashes with "-A", "-T all" to use all available cores
60-
FUZZ=$fuzz_target afl-cmin -T all -A -i ../all_inputs/$fuzz_target -o ../qa-assets/"${FUZZ_INPUTS_DIR}"/$fuzz_target -- ./src/test/fuzz/fuzz
61+
FUZZ=$fuzz_target afl-cmin -T all -A -i ../all_inputs/$fuzz_target -o ../qa-assets/"${FUZZ_INPUTS_DIR}"/$fuzz_target -- ./build_fuzz/src/test/fuzz/fuzz
6162
else
6263
echo "No input corpus for $fuzz_target (ignoring)"
6364
fi
@@ -72,11 +73,13 @@ git clone --depth=1 https://github.com/bitcoin/bitcoin.git
7273
for sanitizer in {"fuzzer","fuzzer,address,undefined,integer"}; do
7374
echo "Adding reduced seeds for sanitizer=${sanitizer}"
7475

75-
./configure LDFLAGS="-fuse-ld=lld" CC=clang-$LLVM_VERSION CXX=clang++-$LLVM_VERSION --enable-fuzz --with-sanitizers="${sanitizer}"
76-
make clean
77-
make -j $(nproc)
76+
rm -rf build_fuzz/
77+
cmake -B build_fuzz \
78+
-DCMAKE_C_COMPILER=clang-$LLVM_VERSION -DCMAKE_CXX_COMPILER=clang++-$LLVM_VERSION \
79+
-DBUILD_FOR_FUZZING=ON -DSANITIZERS="$sanitizer"
80+
cmake --build build_fuzz -j$(nproc)
7881

79-
./test/fuzz/test_runner.py -l DEBUG --par=$(nproc) --m_dir=../all_inputs ../qa-assets/"${FUZZ_INPUTS_DIR}"
82+
( cd build_fuzz; ./test/fuzz/test_runner.py -l DEBUG --par=$(nproc) --m_dir=../../all_inputs ../../qa-assets/"${FUZZ_INPUTS_DIR}" )
8083

8184
(
8285
cd ../qa-assets

0 commit comments

Comments
 (0)