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
13 LLVM_INSTALL_TOOLCHAIN_ONLY
16 configure_lit_site_cfg(
17 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
18 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
20 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
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
27 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
30 set(CLANG_TOOLS_TEST_DEPS
31 # For the clang-apply-replacements test that uses clang-rename.
34 # For the clang-doc tests that emit bitcode files.
37 # Individual tools we test.
38 clang-apply-replacements
39 clang-change-namespace
52 # clang-tidy tests require it.
53 clang-resource-headers
56 # Clang-tidy tests need clang for building modules.
60 # Add lit test dependencies.
64 foreach(dep ${LLVM_UTILS_DEPS})
66 list(APPEND CLANG_TOOLS_TEST_DEPS ${dep})
70 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
71 if (NOT WIN32 OR NOT LLVM_LINK_LLVM_DYLIB)
74 MODULE clang-tidy/CTTestTidyModule.cpp
75 PLUGIN_TOOL clang-tidy
76 DEPENDS clang-tidy-headers)
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
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
99 add_lit_testsuite(check-clang-extra "Running clang-tools-extra/test"
100 ${CMAKE_CURRENT_BINARY_DIR}
101 DEPENDS ${CLANG_TOOLS_TEST_DEPS}
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}