From 1c0ea3db574c920b0f1d404856c8f63a51fc35b0 Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Fri, 30 Dec 2022 17:14:07 +0000 Subject: [PATCH] fluent-bit: refine build (#9321) The fuzz-introspector build of fluent-bit is failing since some processes are killed https://oss-fuzz-build-logs.storage.googleapis.com/log-27d388fe-0493-473c-bad6-47e514519641.txt. The current build builds a lot of internal tests that we don't need and the `-j$(nproc)` may cause a memory overhead for introspector runs . This change avoids building the tests we don't need and avoids parallel linking in introspector runs. --- projects/fluent-bit/build.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/fluent-bit/build.sh b/projects/fluent-bit/build.sh index 375ef0b7c..bee019fef 100755 --- a/projects/fluent-bit/build.sh +++ b/projects/fluent-bit/build.sh @@ -23,6 +23,10 @@ fluent-bit/lib EOF cd fluent-bit + +# Avoid building tests we don't need +sed -i 's/prepare_unit_tests(flb/#prepare_unit_tests(flb/g' ./tests/internal/CMakeLists.txt + sed -i 's/malloc(/fuzz_malloc(/g' ./lib/msgpack-c/src/zone.c sed -i 's/struct msgpack_zone_chunk {/void *fuzz_malloc(size_t size) {if (size > 0xa00000) return NULL;\nreturn malloc(size);}\nstruct msgpack_zone_chunk {/g' ./lib/msgpack-c/src/zone.c @@ -111,6 +115,10 @@ cmake -DFLB_TESTS_INTERNAL=ON \ ${OUTPUT_PLUGINS} \ .. -make -j$(nproc) +if [[ "$SANITIZER" == introspector ]]; then + make +else + make -j$(nproc) +fi cp $SRC/fluent-bit/build/bin/*OSSFUZZ ${OUT}/