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.
4 llvm_canonicalize_cmake_booleans(
7 CLANG_DEFAULT_PIE_ON_LINUX
9 CLANG_ENABLE_STATIC_ANALYZER
15 LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
17 LLVM_ENABLE_REVERSE_ITERATION
19 PPC_LINUX_DEFAULT_IEEELONGDOUBLE
20 LLVM_TOOL_LLVM_DRIVER_BUILD
23 configure_lit_site_cfg(
24 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
25 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
27 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
39 "CMAKE_LIBRARY_OUTPUT_DIRECTORY"
42 configure_lit_site_cfg(
43 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
44 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
46 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
56 option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
58 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
61 list(APPEND CLANG_TEST_DEPS
65 clang-fuzzer-dictionary
66 clang-resource-headers
77 clang-offload-packager
82 if(CLANG_ENABLE_STATIC_ANALYZER)
83 list(APPEND CLANG_TEST_DEPS
89 if (CLANG_ENABLE_ARCMT)
90 list(APPEND CLANG_TEST_DEPS
96 if(CLANG_BUILD_EXAMPLES AND CLANG_PLUGIN_SUPPORT)
97 list(APPEND CLANG_TEST_DEPS
103 LLVMPrintFunctionNames
107 set(CLANG_TEST_PARAMS
111 if( NOT CLANG_BUILT_STANDALONE )
112 list(APPEND CLANG_TEST_DEPS
143 list(APPEND CLANG_TEST_DEPS llvm-lto)
147 if(CLANG_ENABLE_STATIC_ANALYZER)
148 if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS) # Determine if we built them
149 list(APPEND CLANG_TEST_DEPS
151 CheckerDependencyHandlingAnalyzerPlugin
152 CheckerOptionHandlingAnalyzerPlugin
157 if (HAVE_CLANG_REPL_SUPPORT)
158 list(APPEND CLANG_TEST_DEPS
163 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
164 # it without having to pass the --clang= argument
165 configure_file(AST/gen_ast_dump_json_test.py
166 ${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
168 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
169 set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
171 add_lit_testsuite(check-clang "Running the Clang regression tests"
172 ${CMAKE_CURRENT_BINARY_DIR}
174 PARAMS ${CLANG_TEST_PARAMS}
175 DEPENDS ${CLANG_TEST_DEPS}
176 ARGS ${CLANG_TEST_EXTRA_ARGS}
178 set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
180 add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
181 PARAMS ${CLANG_TEST_PARAMS}
182 DEPENDS ${CLANG_TEST_DEPS}
183 FOLDER "Clang tests/Suites"
186 # Add a legacy target spelling: clang-test
187 add_custom_target(clang-test)
188 add_dependencies(clang-test check-clang)
189 set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
191 # FIXME: This logic can be removed once all buildbots have moved
192 # debuginfo-test from clang/test to llvm/projects or monorepo.
193 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
194 message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.")
195 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
196 add_subdirectory(debuginfo-tests)