aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects
diff options
context:
space:
mode:
authorGravatar MarcoFalke <falke.marco@gmail.com>2021-05-08 14:57:00 +0200
committerGravatar GitHub <noreply@github.com>2021-05-08 13:57:00 +0100
commit0da70e1c01e9f14d0792e0d7b64c433cdc2dbbaf (patch)
treeebc8c305e11d5deecb4e9dabcf55a5c43d1339c2 /projects
parent41dcf822ef280668ed8533f4cbed7b02e856af6a (diff)
bitcoin-core: Only compile one fuzz target when OSS_FUZZ_CI (#5738)
Diffstat (limited to 'projects')
-rwxr-xr-xprojects/bitcoin-core/build.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/projects/bitcoin-core/build.sh b/projects/bitcoin-core/build.sh
index 69b3aa44..db965479 100755
--- a/projects/bitcoin-core/build.sh
+++ b/projects/bitcoin-core/build.sh
@@ -49,19 +49,19 @@ make -j$(nproc)
WRITE_ALL_FUZZ_TARGETS_AND_ABORT="/tmp/a" "./src/test/fuzz/fuzz" || true
readarray FUZZ_TARGETS < "/tmp/a"
+if [ -n "${OSS_FUZZ_CI-}" ]; then
+ # When running in CI, check the first targets only to save time and disk space
+ FUZZ_TARGETS=( ${FUZZ_TARGETS[@]:0:2} )
+fi
# Compile the fuzz executable again with a "magic string" as the name of the fuzz target
export MAGIC_STR="b5813eee2abc9d3358151f298b75a72264ffa119d2f71ae7fefa15c4b70b4bc5b38e87e3107a730f25891ea428b2b4fabe7a84f5bfa73c79e0479e085e4ff157"
sed -i "s|std::getenv(\"FUZZ\")|\"$MAGIC_STR\"|g" "./src/test/fuzz/fuzz.cpp"
make -j$(nproc)
-# Clean all build files to avoid out-of-disk errors
-mv "./src/test/fuzz/fuzz" "./fuzz_main"
-make distclean
-
# Replace the magic string with the actual name of each fuzz target
for fuzz_target in ${FUZZ_TARGETS[@]}; do
- python3 -c "c_str_target=b\"${fuzz_target}\x00\";c_str_magic=b\"$MAGIC_STR\";c=open('./fuzz_main','rb').read();c=c.replace(c_str_magic, c_str_target+c_str_magic[len(c_str_target):]);open(\"$OUT/$fuzz_target\",'wb').write(c)"
+ python3 -c "c_str_target=b\"${fuzz_target}\x00\";c_str_magic=b\"$MAGIC_STR\";c=open('./src/test/fuzz/fuzz','rb').read();c=c.replace(c_str_magic, c_str_target+c_str_magic[len(c_str_target):]);open(\"$OUT/$fuzz_target\",'wb').write(c)"
chmod +x "$OUT/$fuzz_target"
(
cd assets/fuzz_seed_corpus