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.
This commit is contained in:
DavidKorczynski 2022-12-30 17:14:07 +00:00 committed by GitHub
parent 55e6ae8cff
commit 1c0ea3db57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -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}/