blob: ac8d459b399281574b3185952293b67749f40ea8 [file] [log] [blame]
Chandler Carruthf71b73d2012-08-07 08:33:041# 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.
Chandler Carruth5f8cfa72012-08-07 07:09:143#
Chandler Carruthf71b73d2012-08-07 08:33:044# 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..
Chandler Carruth5f8cfa72012-08-07 07:09:146
Chandler Carruthf71b73d2012-08-07 08:33:047set(CLANG_TOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
8set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
Chandler Carruth5f8cfa72012-08-07 07:09:149
NAKAMURA Takumic3b3e5e2014-01-19 11:19:0710if (CMAKE_CFG_INTDIR STREQUAL ".")
11 set(LLVM_BUILD_MODE ".")
12else ()
13 set(LLVM_BUILD_MODE "%(build_mode)s")
14endif ()
15
NAKAMURA Takumi49007da2014-01-19 13:00:0116string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
NAKAMURA Takumic3b3e5e2014-01-19 11:19:0717
Michal Gorny24952e52017-08-29 05:58:0818llvm_canonicalize_cmake_booleans(
Jan Korousd05fd412019-01-16 00:24:2219 CLANG_ENABLE_STATIC_ANALYZER
20 CLANGD_BUILD_XPC_SUPPORT)
Michal Gorny24952e52017-08-29 05:58:0821
Edwin Vane08085af2013-02-19 19:08:1022configure_lit_site_cfg(
23 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
24 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
25 )
26
Edwin Vaned22180f2013-04-03 15:11:0827configure_lit_site_cfg(
28 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
29 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
30 )
31
Chandler Carruthe79882e2013-03-07 10:09:4732option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF)
33if(CLANG_TOOLS_TEST_USE_VG)
34 set(CLANG_TOOLS_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
35endif()
36
Chandler Carruthf71b73d2012-08-07 08:33:0437set(CLANG_TOOLS_TEST_DEPS
Alex Lorenz8401b952017-06-30 16:58:3638 # For the clang-apply-replacements test that uses clang-rename.
39 clang-rename
Benjamin Kramerd99fffa2016-03-03 08:58:1240
Julie Hockett395afb12018-03-22 23:34:4641 # For the clang-doc tests that emit bitcode files.
42 llvm-bcanalyzer
43
Chandler Carruthe79882e2013-03-07 10:09:4744 # Individual tools we test.
NAKAMURA Takumi50fcf152013-10-31 12:46:1045 clang-apply-replacements
Eric Liuf68f0cd2016-09-19 17:40:3246 clang-change-namespace
Julie Hockett395afb12018-03-22 23:34:4647 clang-doc
Benjamin Kramer7e310d12016-04-27 14:32:3648 clang-include-fixer
Haojian Wu53bdceb2016-10-04 09:05:3149 clang-move
Peter Collingbourneda776c02014-02-18 19:46:0150 clang-query
Alexander Shaposhnikov3951c8f2016-09-02 02:56:0751 clang-reorder-fields
Benjamin Kramerfa0a0e82016-05-31 12:12:1952 find-all-symbols
NAKAMURA Takumi50fcf152013-10-31 12:46:1053 modularize
NAKAMURA Takumi2ab631e2013-10-31 12:46:1654 pp-trace
Edwin Vaned22180f2013-04-03 15:11:0855
Edwin Vaned22180f2013-04-03 15:11:0856 # Unit tests
57 ExtraToolsUnitTests
Stephen Kelly5351cf62018-10-01 20:24:2258
59 # For the clang-tidy libclang integration test.
60 c-index-test
61 # clang-tidy tests require it.
Shoaib Meenaib8e003b2019-03-04 21:19:5362 clang-resource-headers
Stephen Kelly5351cf62018-10-01 20:24:2263
64 clang-tidy
Jan Korousd05fd412019-01-16 00:24:2265)
66
67if(CLANGD_BUILD_XPC_SUPPORT)
68 list(APPEND CLANG_TOOLS_TEST_DEPS clangd-xpc-test-client)
69endif()
Chandler Carruth5f8cfa72012-08-07 07:09:1470
Haojian Wu318537b2018-10-02 17:22:1171set(CLANGD_TEST_DEPS
72 clangd
73 ClangdTests
74 # clangd-related tools which don't have tests, add them to the test to make
75 # sure we don't introduce new changes that break their compilations.
76 clangd-indexer
77 dexp
78 )
Haojian Wu88085502018-11-22 10:14:5579
Haojian Wu88085502018-11-22 10:14:5580# Add lit test dependencies.
81set(LLVM_UTILS_DEPS
82 FileCheck count not
83)
84foreach(dep ${LLVM_UTILS_DEPS})
85 if(TARGET ${dep})
86 list(APPEND CLANGD_TEST_DEPS ${dep})
87 endif()
88endforeach()
89
Haojian Wu318537b2018-10-02 17:22:1190foreach(clangd_dep ${CLANGD_TEST_DEPS})
91 list(APPEND CLANG_TOOLS_TEST_DEPS
92 ${clangd_dep})
93endforeach()
94
Chandler Carruthe79882e2013-03-07 10:09:4795add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests"
Chandler Carruthf71b73d2012-08-07 08:33:0496 ${CMAKE_CURRENT_BINARY_DIR}
97 DEPENDS ${CLANG_TOOLS_TEST_DEPS}
98 ARGS ${CLANG_TOOLS_TEST_EXTRA_ARGS}
99 )
Chandler Carruthe79882e2013-03-07 10:09:47100
Kirill Bobyrevcb0c6c52017-06-28 20:57:28101set_target_properties(check-clang-tools PROPERTIES FOLDER "Clang extra tools' tests")
Haojian Wu518e0892018-10-01 14:02:02102
103# Setup an individual test for building and testing clangd-only stuff.
Haojian Wu318537b2018-10-02 17:22:11104# Note: all clangd tests have been covered in check-clang-tools, this is a
105# convenient target for clangd developers.
106# Exclude check-clangd from check-all.
Haojian Wu7dff09c2018-10-01 20:21:41107set(EXCLUDE_FROM_ALL ON)
Haojian Wu518e0892018-10-01 14:02:02108add_lit_testsuite(check-clangd "Running the Clangd regression tests"
109 ${CMAKE_CURRENT_BINARY_DIR}/Unit/clangd;${CMAKE_CURRENT_BINARY_DIR}/clangd
110 DEPENDS ${CLANGD_TEST_DEPS}
111)
112set_target_properties(check-clangd PROPERTIES FOLDER "Clangd tests")
Haojian Wu7dff09c2018-10-01 20:21:41113set(EXCLUDE_FROM_ALL OFF)