[clang][lex] NFCI: Use DirectoryEntryRef in HeaderSearch::load*()
[llvm-project.git] / cross-project-tests / CMakeLists.txt
blobaf857e766275310531e681f3aa7f28b1a85e1993
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   count
20   llvm-dwarfdump
21   llvm-config
22   llvm-objdump
23   check-gdb-llvm-support
24   not
25   )
27 if ("clang" IN_LIST LLVM_ENABLE_PROJECTS)
28   list(APPEND CROSS_PROJECT_TEST_DEPS clang)
29 endif()
31 if ("mlir" IN_LIST LLVM_ENABLE_PROJECTS)
32   add_llvm_executable(check-gdb-mlir-support
33         debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
34   )
35   target_include_directories(check-gdb-mlir-support PRIVATE
36                                ${LLVM_EXTERNAL_MLIR_SOURCE_DIR}/include
37                                ${LLVM_BINARY_DIR}/tools/mlir/include)
38   target_link_libraries(check-gdb-mlir-support PRIVATE MLIRIR)
39   list(APPEND CROSS_PROJECT_TEST_DEPS check-gdb-mlir-support)
40   set(MLIR_SOURCE_DIR  ${LLVM_EXTERNAL_MLIR_SOURCE_DIR})
41 endif()
43 if("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS)
44   # llgdb-tests/asan.c and other asan* files.
45   if(TARGET asan)
46     list(APPEND CROSS_PROJECT_TEST_DEPS asan)
47   endif()
48   # llgdb-tests/safestack.c
49   if(TARGET safestack)
50     list(APPEND CROSS_PROJECT_TEST_DEPS safestack)
51   endif()
52 endif()
53 # Many dexter tests depend on lldb.
54 if("lldb" IN_LIST LLVM_ENABLE_PROJECTS)
55   list(APPEND CROSS_PROJECT_TEST_DEPS lldb lldb-server)
56 endif()
58 if ("lld" IN_LIST LLVM_ENABLE_PROJECTS)
59   list(APPEND CROSS_PROJECT_TEST_DEPS lld)
60 endif()
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   )
69 add_lit_testsuite(check-cross-project "Running cross-project tests"
70   ${CMAKE_CURRENT_BINARY_DIR}
71   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
72   )
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   )
81 # Add alias for intrinsic header test subset.
82 add_lit_testsuite(check-intrinsic-headers "Running intrinsic header tests"
83   ${CMAKE_CURRENT_BINARY_DIR}/intrinsic-header-tests
84   EXCLUDE_FROM_CHECK_ALL
85   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
86   )
88 # Add check-cross-project-* targets.
89 add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
90   DEPENDS ${CROSS_PROJECT_TEST_DEPS}
91   )
93 set_target_properties(check-cross-project PROPERTIES FOLDER "Tests")
94 set_target_properties(check-debuginfo PROPERTIES FOLDER "Tests")
95 set_target_properties(check-intrinsic-headers PROPERTIES FOLDER "Tests")