Remove subtarget dependence in pass pipeline setup for AArch64.
[oota-llvm.git] / lib / Fuzzer / test / CMakeLists.txt
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
4 # for the Fuzzer lib)
5 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O0 -fsanitize-coverage=4")
6
7 set(Tests
8   FourIndependentBranchesTest
9   FullCoverageSetTest
10   InfiniteTest
11   NullDerefTest
12   SimpleTest
13   TimeoutTest
14   )
15
16 set(TestBinaries)
17
18 foreach(Test ${Tests})
19   add_executable(LLVMFuzzer-${Test}
20     EXCLUDE_FROM_ALL
21     ${Test}.cpp
22     )
23   target_link_libraries(LLVMFuzzer-${Test}
24     LLVMFuzzer
25     )
26   set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test})
27 endforeach()
28
29 configure_lit_site_cfg(
30   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
31   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
32   )
33
34 configure_lit_site_cfg(
35   ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in
36   ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg
37   )
38
39 include_directories(..)
40 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
41
42 add_executable(LLVMFuzzer-Unittest
43   FuzzerUnittest.cpp
44   $<TARGET_OBJECTS:LLVMFuzzerNoMain>
45   )
46
47 target_link_libraries(LLVMFuzzer-Unittest
48   gtest
49   gtest_main
50   )
51
52 set(TestBinaries ${TestBinaries} LLVMFuzzer-Unittest)
53
54 set_target_properties(${TestBinaries}
55   PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
56   )
57
58 add_lit_testsuite(check-fuzzer "Running Fuzzer tests"
59     ${CMAKE_CURRENT_BINARY_DIR}
60     DEPENDS ${TestBinaries} FileCheck not
61     )