diff --git a/CMakeLists.txt b/CMakeLists.txt index bf72b5c20..47b597222 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -502,8 +502,14 @@ add_subdirectory(unit_tests) add_subdirectory(src/benchmarks) if (ENABLE_FUZZING) - # TODO(daniel-j-h): fuzz against configurable ubsan,msan,asan libosrm builds + # Requires libosrm being built with sanitizers; make configurable and default to ubsan + set(FUZZ_SANITIZER "undefined" CACHE STRING "Sanitizer to be used for Fuzz testing") + set_property(CACHE FUZZ_SANITIZER PROPERTY STRINGS "undefined" "integer" "address" "memory" "thread" "leak") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize-coverage=edge,indirect-calls,8bit-counters -fsanitize=address") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") + + message(STATUS "Using -fsanitize=${FUZZ_SANITIZER} for Fuzz testing") + add_subdirectory(fuzz) endif () diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt index 12db5f5b2..2709624ce 100644 --- a/fuzz/CMakeLists.txt +++ b/fuzz/CMakeLists.txt @@ -8,7 +8,7 @@ # - make more user friendly, at the moment we require you to build and install libFuzzer.a # - pick up LLVM_ROOT # - build libFuzzer on the fly -# +# # clang++ -std=c++11 -stdlib=libc++ -c -g -O2 ~/llvm/lib/Fuzzer/*.cpp -I~/llvm/lib/Fuzzer # ar ruv libFuzzer.a Fuzzer*.o