Merge branch 'dietoref1-2prep-2-3-4-5-6-7-dwzpair-altlink-sharedstmt-dieref-dwz3...
[lldb.git] / cross-project-tests / CMakeLists.txt
1 # Cross project tests, for tests that require access to multiple projects across
2 # LLVM (e.g. clang, lld and lldb).
3 # The subset inside debuginfo-tests invoke clang to generate programs with
4 # various types of debug info, and then run those programs under a debugger
5 # such as GDB or LLDB to verify the results.
6
7 find_package(Python3 COMPONENTS Interpreter)
8
9 add_llvm_executable(check-gdb-llvm-support
10         debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp
11 )
12 target_link_libraries(check-gdb-llvm-support PRIVATE LLVMSupport)
13
14 set(CROSS_PROJECT_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
15 set(CROSS_PROJECT_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
16
17 set(CROSS_PROJECT_TEST_DEPS
18   FileCheck
19   count
20   llvm-config
21   llvm-objdump
22   check-gdb-llvm-support
23   not
24   )
25
26 if ("clang" IN_LIST LLVM_ENABLE_PROJECTS)
27   list(APPEND CROSS_PROJECT_TEST_DEPS clang)
28 endif()
29
30 if ("mlir" IN_LIST LLVM_ENABLE_PROJECTS)
31   add_llvm_executable(check-gdb-mlir-support
32         debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
33   )
34   target_include_directories(check-gdb-mlir-support PRIVATE
35                                ${LLVM_EXTERNAL_MLIR_SOURCE_DIR}/include
36                                ${LLVM_BINARY_DIR}/tools/mlir/include)
37   target_link_libraries(check-gdb-mlir-support PRIVATE MLIRIR)
38   list(APPEND CROSS_PROJECT_TEST_DEPS check-gdb-mlir-support)
39   set(MLIR_SOURCE_DIR  ${LLVM_EXTERNAL_MLIR_SOURCE_DIR})
40 endif()
41
42 if("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS)
43   # llgdb-tests/asan.c and other asan* files.
44   if(TARGET asan)
45     list(APPEND CROSS_PROJECT_TEST_DEPS asan)
46   endif()
47   # llgdb-tests/safestack.c
48   if(TARGET safestack)
49     list(APPEND CROSS_PROJECT_TEST_DEPS safestack)
50   endif()
51 endif()
52 # Many dexter tests depend on lldb.
53 if("lldb" IN_LIST LLVM_ENABLE_PROJECTS)
54   list(APPEND CROSS_PROJECT_TEST_DEPS lldb lldb-server)
55 endif()
56
57 # The Windows builder scripts pass -fuse-ld=lld.
58 if (WIN32 OR "lld" IN_LIST LLVM_ENABLE_PROJECTS)
59   list(APPEND CROSS_PROJECT_TEST_DEPS lld)
60 endif()
61
62 configure_lit_site_cfg(
63   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
64   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
65   MAIN_CONFIG
66   ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
67   )
68
69 add_lit_testsuite(check-cross-project "Running cross-project tests"
70   ${CMAKE_CURRENT_BINARY_DIR}
71   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
72   )
73
74 # Add alias for debuginfo test subset.
75 add_lit_testsuite(check-debuginfo "Running debuginfo tests"
76   ${CMAKE_CURRENT_BINARY_DIR}/debuginfo-tests
77   EXCLUDE_FROM_CHECK_ALL
78   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
79   )
80
81 # Add check-cross-project-* targets.
82 add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
83   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
84   )
85
86 set_target_properties(check-cross-project PROPERTIES FOLDER "Tests")
87 set_target_properties(check-debuginfo PROPERTIES FOLDER "Tests")