1 # Build all these tests with -O0, otherwise optimizations may merge some
2 # basic blocks and we'll fail to discover the targets.
3 # Also enable the coverage instrumentation back (it is disabled
5 set(CMAKE_CXX_FLAGS_RELEASE "${LIBFUZZER_FLAGS_BASE} -O0 -fsanitize-coverage=edge,indirect-calls")
18 FourIndependentBranchesTest
33 UserSuppliedFuzzerTest
36 set(UninstrumentedTests
46 foreach(Test ${Tests})
47 add_executable(LLVMFuzzer-${Test}
50 target_link_libraries(LLVMFuzzer-${Test}
53 set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test})
56 foreach(Test ${CustomMainTests})
57 add_executable(LLVMFuzzer-${Test}
60 target_link_libraries(LLVMFuzzer-${Test}
63 set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test})
67 configure_lit_site_cfg(
68 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
69 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
72 configure_lit_site_cfg(
73 ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
74 ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg
77 include_directories(..)
78 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
80 add_executable(LLVMFuzzer-Unittest
82 $<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
85 target_link_libraries(LLVMFuzzer-Unittest
90 set(TestBinaries ${TestBinaries} LLVMFuzzer-Unittest)
92 add_subdirectory(dfsan)
94 foreach(Test ${DFSanTests})
95 set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test}-DFSan)
98 add_subdirectory(uninstrumented)
100 foreach(Test ${UninstrumentedTests})
101 set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test}-Uninstrumented)
104 add_subdirectory(trace-bb)
106 foreach(Test ${TraceBBTests})
107 set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test}-TraceBB)
110 set_target_properties(${TestBinaries}
111 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
114 add_lit_testsuite(check-fuzzer "Running Fuzzer tests"
115 ${CMAKE_CURRENT_BINARY_DIR}
116 DEPENDS ${TestBinaries} FileCheck not