[Tarantool-patches] [PATCH 4/4] test: integrate with OSS Fuzz

sergeyb at tarantool.org sergeyb at tarantool.org
Mon Nov 30 23:24:52 MSK 2020


From: Sergey Bronnikov <sergeyb at tarantool.org>

To run Tarantool fuzzers on OSS Fuzz infrastructure it is needed to pass
library $LIB_FUZZING_ENGINE to linker and use external CFLAGS and CXXFLAGS.
Full description how to integrate with OSS Fuzz is in [1] and [2].

Patch to OSS Fuzz repository [2] is ready to merge.

1. https://google.github.io/oss-fuzz/getting-started/new-project-guide/
2. https://google.github.io/oss-fuzz/advanced-topics/ideal-integration/
3. https://github.com/google/oss-fuzz/pull/4723

Closes #1809
---
 test/fuzz/CMakeLists.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/test/fuzz/CMakeLists.txt b/test/fuzz/CMakeLists.txt
index 142d38f67..3abedbf08 100644
--- a/test/fuzz/CMakeLists.txt
+++ b/test/fuzz/CMakeLists.txt
@@ -14,6 +14,13 @@ target_compile_options(
         $<$<BOOL:${ENABLE_UB_SANITIZER}>:
         -fsanitize=fuzzer,undefined
         >
+        $<$<NOT:$<BOOL:${OSS_FUZZ}>>:
+          -fsanitize=fuzzer
+        >
+        $<$<BOOL:${OSS_FUZZ}>:
+        ${CXX}
+        ${CXXFLAGS}
+        >
 )
 target_link_libraries(
     fuzzer_config
@@ -24,6 +31,12 @@ target_link_libraries(
         $<$<BOOL:${ENABLE_UB_SANITIZER}>:
         -fsanitize=fuzzer,undefined
         >
+        $<$<NOT:$<BOOL:${OSS_FUZZ}>>:
+          -fsanitize=fuzzer
+        >
+        $<$<BOOL:${OSS_FUZZ}>:
+        $ENV{LIB_FUZZING_ENGINE}
+        >
 )
 
 # Use PUBLIC to force 'fuzzer_config' for all dependent targets.
-- 
2.25.1


More information about the Tarantool-patches mailing list