2015-01-29 23:01:07 +00:00
|
|
|
# Build all these tests with -O0, otherwise optimizations may merge some
|
|
|
|
# basic blocks and we'll fail to discover the targets.
|
|
|
|
# Also enable the coverage instrumentation back (it is disabled
|
|
|
|
# for the Fuzzer lib)
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O0 -fsanitize-coverage=4")
|
|
|
|
|
2015-01-29 16:58:29 +00:00
|
|
|
set(Tests
|
2015-02-20 03:02:37 +00:00
|
|
|
FourIndependentBranchesTest
|
2015-01-29 23:01:07 +00:00
|
|
|
FullCoverageSetTest
|
2015-01-29 16:58:29 +00:00
|
|
|
InfiniteTest
|
|
|
|
NullDerefTest
|
|
|
|
SimpleTest
|
|
|
|
TimeoutTest
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TestBinaries)
|
|
|
|
|
|
|
|
foreach(Test ${Tests})
|
|
|
|
add_executable(LLVMFuzzer-${Test}
|
|
|
|
EXCLUDE_FROM_ALL
|
|
|
|
${Test}.cpp
|
|
|
|
)
|
|
|
|
target_link_libraries(LLVMFuzzer-${Test}
|
|
|
|
LLVMFuzzer
|
|
|
|
)
|
|
|
|
set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test})
|
|
|
|
endforeach()
|
|
|
|
|
2015-01-30 23:26:57 +00:00
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
)
|
|
|
|
|
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg
|
|
|
|
)
|
|
|
|
|
|
|
|
include_directories(..)
|
|
|
|
include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
|
|
|
|
|
|
|
|
add_executable(LLVMFuzzer-Unittest
|
|
|
|
FuzzerUnittest.cpp
|
|
|
|
$<TARGET_OBJECTS:LLVMFuzzerNoMain>
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(LLVMFuzzer-Unittest
|
|
|
|
gtest
|
|
|
|
gtest_main
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TestBinaries ${TestBinaries} LLVMFuzzer-Unittest)
|
|
|
|
|
2015-01-29 16:58:29 +00:00
|
|
|
set_target_properties(${TestBinaries}
|
|
|
|
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_lit_testsuite(check-fuzzer "Running Fuzzer tests"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2015-02-03 21:57:32 +00:00
|
|
|
DEPENDS ${TestBinaries} FileCheck not
|
2015-01-29 16:58:29 +00:00
|
|
|
)
|