1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 22:42:46 +02:00
llvm-mirror/lib/Fuzzer/test/CMakeLists.txt
Ivan Krasin cc79d453f1 [libFuzzer]Add a test for defeating a hash sum.
Summary:
Add a test for a data followed by 4-byte hash value.
I use a slightly modified Jenkins hash function,
as described in https://en.wikipedia.org/wiki/Jenkins_hash_function

The modification is to ensure that hash(zeros) != 0.

Reviewers: kcc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12648

llvm-svn: 247076
2015-09-08 21:22:52 +00:00

101 lines
2.1 KiB
CMake

# 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 "${LIBFUZZER_FLAGS_BASE} -O0 -fsanitize-coverage=edge,indirect-calls")
set(DFSanTests
MemcmpTest
SimpleCmpTest
StrcmpTest
StrncmpTest
SwitchTest
)
set(Tests
CounterTest
CxxTokensTest
FourIndependentBranchesTest
FullCoverageSetTest
InfiniteTest
MemcmpTest
NullDerefTest
SimpleCmpTest
SimpleDictionaryTest
SimpleHashTest
SimpleTest
StrcmpTest
StrncmpTest
SwitchTest
TimeoutTest
)
set(CustomMainTests
UserSuppliedFuzzerTest
)
set(TestBinaries)
foreach(Test ${Tests})
add_executable(LLVMFuzzer-${Test}
${Test}.cpp
)
target_link_libraries(LLVMFuzzer-${Test}
LLVMFuzzer
)
set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test})
endforeach()
foreach(Test ${CustomMainTests})
add_executable(LLVMFuzzer-${Test}
${Test}.cpp
)
target_link_libraries(LLVMFuzzer-${Test}
LLVMFuzzerNoMain
)
set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test})
endforeach()
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:LLVMFuzzerNoMainObjects>
)
target_link_libraries(LLVMFuzzer-Unittest
gtest
gtest_main
)
set(TestBinaries ${TestBinaries} LLVMFuzzer-Unittest)
add_subdirectory(dfsan)
foreach(Test ${DFSanTests})
set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test}-DFSan)
endforeach()
set_target_properties(${TestBinaries}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_lit_testsuite(check-fuzzer "Running Fuzzer tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${TestBinaries} FileCheck not
)