150
|
1 # Test runner infrastructure for Clang. This configures the Clang test trees
|
|
2 # for use by Lit, and delegates to LLVM's lit test handlers.
|
|
3
|
|
4 if (CMAKE_CFG_INTDIR STREQUAL ".")
|
|
5 set(LLVM_BUILD_MODE ".")
|
|
6 else ()
|
|
7 set(LLVM_BUILD_MODE "%(build_mode)s")
|
|
8 endif ()
|
|
9
|
|
10 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
|
|
11
|
|
12 llvm_canonicalize_cmake_booleans(
|
|
13 CLANG_BUILD_EXAMPLES
|
|
14 CLANG_ENABLE_ARCMT
|
|
15 CLANG_ENABLE_STATIC_ANALYZER
|
|
16 CLANG_SPAWN_CC1
|
|
17 ENABLE_BACKTRACES
|
221
|
18 LLVM_ENABLE_NEW_PASS_MANAGER
|
|
19 LLVM_ENABLE_ZLIB
|
150
|
20 LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
|
|
21 LLVM_ENABLE_PLUGINS
|
|
22 LLVM_ENABLE_THREADS)
|
|
23
|
|
24 configure_lit_site_cfg(
|
|
25 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
26 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
|
27 MAIN_CONFIG
|
|
28 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
|
173
|
29 PATHS
|
|
30 "LLVM_SOURCE_DIR"
|
|
31 "LLVM_BINARY_DIR"
|
|
32 "LLVM_TOOLS_DIR"
|
|
33 "LLVM_LIBS_DIR"
|
|
34 "SHLIBDIR"
|
|
35 "LLVM_LIT_TOOLS_DIR"
|
|
36 "CLANG_BINARY_DIR"
|
|
37 "CLANG_SOURCE_DIR"
|
|
38 "CLANG_TOOLS_DIR"
|
150
|
39 )
|
|
40
|
|
41 configure_lit_site_cfg(
|
|
42 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
43 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
|
|
44 MAIN_CONFIG
|
|
45 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
|
173
|
46 PATHS
|
|
47 "LLVM_SOURCE_DIR"
|
|
48 "LLVM_BINARY_DIR"
|
|
49 "LLVM_TOOLS_DIR"
|
|
50 "LLVM_LIBS_DIR"
|
|
51 "CLANG_BINARY_DIR"
|
|
52 "SHLIBDIR"
|
150
|
53 )
|
|
54
|
|
55 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
|
|
56 if(CLANG_TEST_USE_VG)
|
|
57 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
|
|
58 endif ()
|
|
59
|
|
60 list(APPEND CLANG_TEST_DEPS
|
221
|
61 apinotes-test
|
150
|
62 c-index-test
|
|
63 clang
|
|
64 clang-resource-headers
|
|
65 clang-format
|
|
66 clang-tblgen
|
|
67 clang-offload-bundler
|
|
68 clang-import-test
|
|
69 clang-rename
|
|
70 clang-refactor
|
221
|
71 clang-repl
|
150
|
72 clang-diff
|
|
73 clang-scan-deps
|
|
74 diagtool
|
|
75 hmaptool
|
|
76 )
|
|
77
|
|
78 if(CLANG_ENABLE_STATIC_ANALYZER)
|
|
79 list(APPEND CLANG_TEST_DEPS
|
|
80 clang-check
|
|
81 clang-extdef-mapping
|
|
82 )
|
|
83 endif()
|
|
84
|
|
85 if (CLANG_ENABLE_ARCMT)
|
|
86 list(APPEND CLANG_TEST_DEPS
|
|
87 arcmt-test
|
|
88 c-arcmt-test
|
|
89 )
|
|
90 endif ()
|
|
91
|
|
92 if (CLANG_BUILD_EXAMPLES)
|
|
93 list(APPEND CLANG_TEST_DEPS
|
173
|
94 Attribute
|
150
|
95 AnnotateFunctions
|
221
|
96 CallSuperAttr
|
150
|
97 clang-interpreter
|
|
98 PrintFunctionNames
|
|
99 )
|
|
100 endif ()
|
|
101
|
|
102 set(CLANG_TEST_PARAMS
|
|
103 USE_Z3_SOLVER=0
|
|
104 )
|
|
105
|
|
106 if( NOT CLANG_BUILT_STANDALONE )
|
|
107 list(APPEND CLANG_TEST_DEPS
|
|
108 llvm-config
|
|
109 FileCheck count not
|
|
110 llc
|
|
111 llvm-as
|
|
112 llvm-bcanalyzer
|
|
113 llvm-cat
|
|
114 llvm-cxxfilt
|
|
115 llvm-dis
|
|
116 llvm-dwarfdump
|
|
117 llvm-ifs
|
|
118 llvm-lto2
|
|
119 llvm-modextract
|
|
120 llvm-nm
|
|
121 llvm-objcopy
|
|
122 llvm-objdump
|
|
123 llvm-profdata
|
221
|
124 llvm-rc
|
150
|
125 llvm-readelf
|
|
126 llvm-readobj
|
221
|
127 llvm-strip
|
150
|
128 llvm-symbolizer
|
221
|
129 llvm-windres
|
150
|
130 opt
|
221
|
131 split-file
|
|
132 yaml2obj
|
150
|
133 )
|
|
134
|
|
135 if(TARGET llvm-lto)
|
|
136 list(APPEND CLANG_TEST_DEPS llvm-lto)
|
|
137 endif()
|
|
138 endif()
|
|
139
|
|
140 if (CLANG_ENABLE_STATIC_ANALYZER)
|
|
141 if (LLVM_ENABLE_PLUGINS)
|
|
142 list(APPEND CLANG_TEST_DEPS
|
|
143 SampleAnalyzerPlugin
|
|
144 CheckerDependencyHandlingAnalyzerPlugin
|
|
145 CheckerOptionHandlingAnalyzerPlugin
|
|
146 )
|
|
147 endif()
|
|
148 endif()
|
|
149
|
|
150 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
|
|
151 # it without having to pass the --clang= argument
|
|
152 configure_file(AST/gen_ast_dump_json_test.py
|
|
153 ${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
|
|
154
|
|
155 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
|
|
156 set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
|
|
157
|
|
158 add_lit_testsuite(check-clang "Running the Clang regression tests"
|
|
159 ${CMAKE_CURRENT_BINARY_DIR}
|
|
160 #LIT ${LLVM_LIT}
|
|
161 PARAMS ${CLANG_TEST_PARAMS}
|
|
162 DEPENDS ${CLANG_TEST_DEPS}
|
|
163 ARGS ${CLANG_TEST_EXTRA_ARGS}
|
|
164 )
|
|
165 set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
|
|
166
|
|
167 add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
|
|
168 PARAMS ${CLANG_TEST_PARAMS}
|
|
169 DEPENDS ${CLANG_TEST_DEPS}
|
|
170 )
|
|
171
|
|
172 # Add a legacy target spelling: clang-test
|
|
173 add_custom_target(clang-test)
|
|
174 add_dependencies(clang-test check-clang)
|
|
175 set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
|
|
176
|
|
177 # FIXME: This logic can be removed once all buildbots have moved
|
|
178 # debuginfo-test from clang/test to llvm/projects or monorepo.
|
|
179 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
|
|
180 message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.")
|
|
181 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
|
|
182 add_subdirectory(debuginfo-tests)
|
|
183 endif()
|
|
184 endif()
|