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
106 set(CLANG_TEST_PARAMS
110 if( NOT CLANG_BUILT_STANDALONE )
111 list(APPEND CLANG_TEST_DEPS
142 list(APPEND CLANG_TEST_DEPS llvm-lto)
146 if(CLANG_ENABLE_STATIC_ANALYZER)
147 if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS) # Determine if we built them
148 list(APPEND CLANG_TEST_DEPS
150 CheckerDependencyHandlingAnalyzerPlugin
151 CheckerOptionHandlingAnalyzerPlugin
156 if (HAVE_CLANG_REPL_SUPPORT)
157 list(APPEND CLANG_TEST_DEPS
162 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
163 # it without having to pass the --clang= argument
164 configure_file(AST/gen_ast_dump_json_test.py
165 ${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
167 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
168 set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
170 add_lit_testsuite(check-clang "Running the Clang regression tests"
171 ${CMAKE_CURRENT_BINARY_DIR}
173 PARAMS ${CLANG_TEST_PARAMS}
174 DEPENDS ${CLANG_TEST_DEPS}
175 ARGS ${CLANG_TEST_EXTRA_ARGS}
177 set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
179 add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
180 PARAMS ${CLANG_TEST_PARAMS}
181 DEPENDS ${CLANG_TEST_DEPS}
182 FOLDER "Clang tests/Suites"
185 # Add a legacy target spelling: clang-test
186 add_custom_target(clang-test)
187 add_dependencies(clang-test check-clang)
188 set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
190 # FIXME: This logic can be removed once all buildbots have moved
191 # debuginfo-test from clang/test to llvm/projects or monorepo.
192 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
193 message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.")
194 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
195 add_subdirectory(debuginfo-tests)