[memprof] Upgrade a unit test to MemProf Version 3 (#117063)
[llvm-project.git] / cross-project-tests / CMakeLists.txt
blob7f2fee48fda778e7fd224b3dbb2d022ac07b5556
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 set(LLVM_SUBPROJECT_TITLE "Cross-Project")
8 find_package(Python3 COMPONENTS Interpreter)
10 add_llvm_executable(check-gdb-llvm-support
11         debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp
13 target_link_libraries(check-gdb-llvm-support PRIVATE LLVMSupport)
15 set(CROSS_PROJECT_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
16 set(CROSS_PROJECT_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
18 set(CROSS_PROJECT_TEST_DEPS
19   FileCheck
20   check-gdb-llvm-support
21   count
22   llvm-dwarfdump
23   llvm-config
24   llvm-objdump
25   split-file
26   not
27   )
29 if ("clang" IN_LIST LLVM_ENABLE_PROJECTS)
30   list(APPEND CROSS_PROJECT_TEST_DEPS clang)
31 endif()
33 if ("mlir" IN_LIST LLVM_ENABLE_PROJECTS)
34   add_llvm_executable(check-gdb-mlir-support
35         debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
36   )
37   target_include_directories(check-gdb-mlir-support PRIVATE
38                                ${LLVM_EXTERNAL_MLIR_SOURCE_DIR}/include
39                                ${LLVM_BINARY_DIR}/tools/mlir/include)
40   target_link_libraries(check-gdb-mlir-support PRIVATE MLIRIR)
41   list(APPEND CROSS_PROJECT_TEST_DEPS check-gdb-mlir-support)
42   set(MLIR_SOURCE_DIR  ${LLVM_EXTERNAL_MLIR_SOURCE_DIR})
43 endif()
45 if("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS)
46   # llgdb-tests/asan.c and other asan* files.
47   if(TARGET asan)
48     list(APPEND CROSS_PROJECT_TEST_DEPS asan)
49   endif()
50   # llgdb-tests/safestack.c
51   if(TARGET safestack)
52     list(APPEND CROSS_PROJECT_TEST_DEPS safestack)
53   endif()
54 endif()
55 # Many dexter tests depend on lldb.
56 if("lldb" IN_LIST LLVM_ENABLE_PROJECTS)
57   list(APPEND CROSS_PROJECT_TEST_DEPS lldb lldb-server)
58 endif()
60 if ("lld" IN_LIST LLVM_ENABLE_PROJECTS)
61   list(APPEND CROSS_PROJECT_TEST_DEPS lld)
62 endif()
64 configure_lit_site_cfg(
65   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
66   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
67   MAIN_CONFIG
68   ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
69   )
71 add_lit_testsuite(check-cross-project "Running cross-project tests"
72   ${CMAKE_CURRENT_BINARY_DIR}
73   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
74   )
76 # Add alias for debuginfo test subset.
77 add_lit_testsuite(check-debuginfo "Running debuginfo tests"
78   ${CMAKE_CURRENT_BINARY_DIR}/debuginfo-tests
79   EXCLUDE_FROM_CHECK_ALL
80   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
81   )
83 # Add alias for intrinsic header test subset.
84 add_lit_testsuite(check-intrinsic-headers "Running intrinsic header tests"
85   ${CMAKE_CURRENT_BINARY_DIR}/intrinsic-header-tests
86   EXCLUDE_FROM_CHECK_ALL
87   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
88   )
90 # AMDGPU tests.
91 add_lit_testsuite(check-cross-amdgpu "Running AMDGPU cross-project tests"
92   ${CMAKE_CURRENT_BINARY_DIR}/amdgpu
93   EXCLUDE_FROM_CHECK_ALL
94   DEPENDS clang
95   )
97 # Add check-cross-project-* targets.
98 add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
99   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
100   )