[mlir][sparse] implement non-permutation MapRef encoding (#69406)
[llvm-project.git] / clang-tools-extra / test / CMakeLists.txt
blobf4c529ee8af2077f715568f3e84f524932c457c3
1 # Test runner infrastructure for Clang-based tools. This configures the Clang
2 # test trees for use by Lit, and delegates to LLVM's lit test handlers.
4 # Note that currently we don't support stand-alone builds of Clang, you must
5 # be building Clang from within a combined LLVM+Clang checkout..
7 set(CLANG_TOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
8 set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
10 llvm_canonicalize_cmake_booleans(
11   CLANG_TIDY_ENABLE_STATIC_ANALYZER
12   CLANG_PLUGIN_SUPPORT
13   LLVM_INSTALL_TOOLCHAIN_ONLY
14   )
16 configure_lit_site_cfg(
17   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
18   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
19   MAIN_CONFIG
20   ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
21   )
23 configure_lit_site_cfg(
24   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
25   ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
26   MAIN_CONFIG
27   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
28   )
30 set(CLANG_TOOLS_TEST_DEPS
31   # For the clang-apply-replacements test that uses clang-rename.
32   clang-rename
34   # For the clang-doc tests that emit bitcode files.
35   llvm-bcanalyzer
37   # Individual tools we test.
38   clang-apply-replacements
39   clang-change-namespace
40   clang-doc
41   clang-include-fixer
42   clang-move
43   clang-query
44   clang-reorder-fields
45   find-all-symbols
46   modularize
47   pp-trace
49   # Unit tests
50   ExtraToolsUnitTests
52   # clang-tidy tests require it.
53   clang-resource-headers
55   clang-tidy
56   # Clang-tidy tests need clang for building modules.
57   clang
60 # Add lit test dependencies.
61 set(LLVM_UTILS_DEPS
62   FileCheck count not
64 foreach(dep ${LLVM_UTILS_DEPS})
65   if(TARGET ${dep})
66     list(APPEND CLANG_TOOLS_TEST_DEPS ${dep})
67   endif()
68 endforeach()
70 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
71   if (NOT WIN32 OR NOT LLVM_LINK_LLVM_DYLIB)
72     llvm_add_library(
73         CTTestTidyModule
74         MODULE clang-tidy/CTTestTidyModule.cpp
75         PLUGIN_TOOL clang-tidy
76         DEPENDS clang-tidy-headers)
77   endif()
79   if(CLANG_BUILT_STANDALONE)
80     # LLVMHello library is needed below
81     if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
82        AND NOT TARGET LLVMHello)
83       add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
84         lib/Transforms/Hello)
85     endif()
86   endif()
88   if(TARGET CTTestTidyModule)
89       list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
90       target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
91       if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
92         set(LLVM_LINK_COMPONENTS
93           Support
94         )
95       endif()
96   endif()
97 endif()
99 add_lit_testsuite(check-clang-extra "Running clang-tools-extra/test"
100    ${CMAKE_CURRENT_BINARY_DIR}
101    DEPENDS ${CLANG_TOOLS_TEST_DEPS}
102    )
103 set_target_properties(check-clang-extra PROPERTIES FOLDER "Clang extra tools' tests")
105 add_lit_testsuites(CLANG-EXTRA ${CMAKE_CURRENT_SOURCE_DIR}
106   DEPENDS ${CLANG_TOOLS_TEST_DEPS}
107   )