aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-12-14 15:52:39 +0100
committerMarcoFalke <falke.marco@gmail.com>2020-12-14 16:55:56 +0100
commitfa13e1b0c52738492310b6b421d8e38cb04da5b1 (patch)
tree61d52e5545a70dd21ad1b36861a5463397d4ab1f /src/test
parent44444ba759480237172d83f42374c5c29c76eda0 (diff)
downloadbitcoin-fa13e1b0c52738492310b6b421d8e38cb04da5b1.tar.xz
build: Add option --enable-danger-fuzz-link-all
Diffstat (limited to 'src/test')
-rwxr-xr-xsrc/test/fuzz/danger_link_all.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/fuzz/danger_link_all.sh b/src/test/fuzz/danger_link_all.sh
new file mode 100755
index 0000000000..2ddd00c658
--- /dev/null
+++ b/src/test/fuzz/danger_link_all.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+# Copyright (c) 2020 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+export LC_ALL=C.UTF-8
+
+set -e
+
+ROOT_DIR="$(git rev-parse --show-toplevel)"
+
+# Run only once (break make recursion)
+if [ -d "${ROOT_DIR}/lock_fuzz_link_all" ]; then
+ exit
+fi
+mkdir "${ROOT_DIR}/lock_fuzz_link_all"
+
+echo "Linking each fuzz target separately."
+for FUZZING_HARNESS in $(PRINT_ALL_FUZZ_TARGETS_AND_ABORT=1 "${ROOT_DIR}/src/test/fuzz/fuzz" | sort -u); do
+ echo "Building src/test/fuzz/${FUZZING_HARNESS} ..."
+ git checkout -- "${ROOT_DIR}/src/test/fuzz/fuzz.cpp"
+ sed -i "s/std::getenv(\"FUZZ\")/\"${FUZZING_HARNESS}\"/g" "${ROOT_DIR}/src/test/fuzz/fuzz.cpp"
+ make
+ mv "${ROOT_DIR}/src/test/fuzz/fuzz" "${ROOT_DIR}/src/test/fuzz/${FUZZING_HARNESS}"
+done
+git checkout -- "${ROOT_DIR}/src/test/fuzz/fuzz.cpp"
+rmdir "${ROOT_DIR}/lock_fuzz_link_all"
+echo "Successfully built all fuzz targets."