docs: Document policy around GitHub branches
[llvm-project.git] / cross-project-tests / CMakeLists.txt
blobf7c2ca7ad83de3ca04e354088d3775d2fbdec7b9
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.
7 find_package(Python3 COMPONENTS Interpreter)
9 add_llvm_executable(check-gdb-llvm-support
10         debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp
12 target_link_libraries(check-gdb-llvm-support PRIVATE LLVMSupport)
14 set(CROSS_PROJECT_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
15 set(CROSS_PROJECT_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
17 set(CROSS_PROJECT_TEST_DEPS
18   FileCheck
19   check-gdb-llvm-support
20   count
21   llvm-dwarfdump
22   llvm-config
23   llvm-objdump
24   split-file
25   not
26   )
28 if ("clang" IN_LIST LLVM_ENABLE_PROJECTS)
29   list(APPEND CROSS_PROJECT_TEST_DEPS clang)
30 endif()
32 if ("mlir" IN_LIST LLVM_ENABLE_PROJECTS)
33   add_llvm_executable(check-gdb-mlir-support
34         debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
35   )
36   target_include_directories(check-gdb-mlir-support PRIVATE
37                                ${LLVM_EXTERNAL_MLIR_SOURCE_DIR}/include
38                                ${LLVM_BINARY_DIR}/tools/mlir/include)
39   target_link_libraries(check-gdb-mlir-support PRIVATE MLIRIR)
40   list(APPEND CROSS_PROJECT_TEST_DEPS check-gdb-mlir-support)
41   set(MLIR_SOURCE_DIR  ${LLVM_EXTERNAL_MLIR_SOURCE_DIR})
42 endif()
44 if("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS)
45   # llgdb-tests/asan.c and other asan* files.
46   if(TARGET asan)
47     list(APPEND CROSS_PROJECT_TEST_DEPS asan)
48   endif()
49   # llgdb-tests/safestack.c
50   if(TARGET safestack)
51     list(APPEND CROSS_PROJECT_TEST_DEPS safestack)
52   endif()
53 endif()
54 # Many dexter tests depend on lldb.
55 if("lldb" IN_LIST LLVM_ENABLE_PROJECTS)
56   list(APPEND CROSS_PROJECT_TEST_DEPS lldb lldb-server)
57 endif()
59 if ("lld" IN_LIST LLVM_ENABLE_PROJECTS)
60   list(APPEND CROSS_PROJECT_TEST_DEPS lld)
61 endif()
63 configure_lit_site_cfg(
64   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
65   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
66   MAIN_CONFIG
67   ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
68   )
70 add_lit_testsuite(check-cross-project "Running cross-project tests"
71   ${CMAKE_CURRENT_BINARY_DIR}
72   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
73   )
75 # Add alias for debuginfo test subset.
76 add_lit_testsuite(check-debuginfo "Running debuginfo tests"
77   ${CMAKE_CURRENT_BINARY_DIR}/debuginfo-tests
78   EXCLUDE_FROM_CHECK_ALL
79   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
80   )
82 # Add alias for intrinsic header test subset.
83 add_lit_testsuite(check-intrinsic-headers "Running intrinsic header tests"
84   ${CMAKE_CURRENT_BINARY_DIR}/intrinsic-header-tests
85   EXCLUDE_FROM_CHECK_ALL
86   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
87   )
89 # AMDGPU tests.
90 add_lit_testsuite(check-cross-amdgpu "Running AMDGPU cross-project tests"
91   ${CMAKE_CURRENT_BINARY_DIR}/amdgpu
92   EXCLUDE_FROM_CHECK_ALL
93   DEPENDS clang
94   )
96 # Add check-cross-project-* targets.
97 add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
98   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
99   )
101 set_target_properties(check-cross-project PROPERTIES FOLDER "Tests")
102 set_target_properties(check-debuginfo PROPERTIES FOLDER "Tests")
103 set_target_properties(check-intrinsic-headers PROPERTIES FOLDER "Tests")
104 set_target_properties(check-cross-amdgpu PROPERTIES FOLDER "Tests")