Make sanitizer used for Fuzz testing configurable via FUZZ_SANITIZER

This commit is contained in:
Daniel J. Hofmann 2016-04-13 09:43:03 +02:00 committed by Patrick Niklaus
parent 2557bdcf39
commit 3a0eed2ee5
No known key found for this signature in database
GPG Key ID: E426891B5F978B1B
2 changed files with 8 additions and 2 deletions

View File

@ -502,8 +502,14 @@ add_subdirectory(unit_tests)
add_subdirectory(src/benchmarks) add_subdirectory(src/benchmarks)
if (ENABLE_FUZZING) 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_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") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
message(STATUS "Using -fsanitize=${FUZZ_SANITIZER} for Fuzz testing")
add_subdirectory(fuzz) add_subdirectory(fuzz)
endif () endif ()

View File

@ -8,7 +8,7 @@
# - make more user friendly, at the moment we require you to build and install libFuzzer.a # - make more user friendly, at the moment we require you to build and install libFuzzer.a
# - pick up LLVM_ROOT # - pick up LLVM_ROOT
# - build libFuzzer on the fly # - build libFuzzer on the fly
# #
# clang++ -std=c++11 -stdlib=libc++ -c -g -O2 ~/llvm/lib/Fuzzer/*.cpp -I~/llvm/lib/Fuzzer # clang++ -std=c++11 -stdlib=libc++ -c -g -O2 ~/llvm/lib/Fuzzer/*.cpp -I~/llvm/lib/Fuzzer
# ar ruv libFuzzer.a Fuzzer*.o # ar ruv libFuzzer.a Fuzzer*.o