blob: 591a9272ae6df21e032c5b2426741a01945d15ca [file] [log] [blame]
Chandler Carruth82a53bd2012-06-30 10:14:27 +00001# Test runner infrastructure for Clang. This configures the Clang test trees
2# for use by Lit, and delegates to LLVM's lit test handlers.
Douglas Gregoreb357b62009-06-05 16:00:31 +00003
Stephen Hines651f13c2014-04-23 16:59:28 -07004if (CMAKE_CFG_INTDIR STREQUAL ".")
5 set(LLVM_BUILD_MODE ".")
6else ()
7 set(LLVM_BUILD_MODE "%(build_mode)s")
8endif ()
9
10string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
Daniel Dunbar1e634922009-11-07 23:53:32 +000011
Chandler Carruth65cf6242012-06-29 00:39:23 +000012configure_lit_site_cfg(
Daniel Dunbar1e634922009-11-07 23:53:32 +000013 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
Chandler Carruth65cf6242012-06-29 00:39:23 +000014 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
15 )
Daniel Dunbar1e634922009-11-07 23:53:32 +000016
Chandler Carruth65cf6242012-06-29 00:39:23 +000017configure_lit_site_cfg(
NAKAMURA Takumic3189e92011-02-03 09:01:12 +000018 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
19 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
Chandler Carruth65cf6242012-06-29 00:39:23 +000020 )
NAKAMURA Takumic3189e92011-02-03 09:01:12 +000021
Chandler Carruth82a53bd2012-06-30 10:14:27 +000022option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
23if(CLANG_TEST_USE_VG)
24 set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
25endif ()
26
Stephen Hines651f13c2014-04-23 16:59:28 -070027list(APPEND CLANG_TEST_DEPS
Jordan Rose6bbaa772013-02-08 07:28:25 +000028 clang clang-headers
Daniel Jasper0ff72fc2013-03-25 09:14:25 +000029 clang-check clang-format
Stephen Hines176edba2014-12-01 14:53:08 -080030 c-index-test diagtool
Stephen Hines651f13c2014-04-23 16:59:28 -070031 clang-tblgen
Jordan Rose6bbaa772013-02-08 07:28:25 +000032 )
Stephen Hinesc568f1e2014-07-21 00:47:37 -070033
Stephen Hines176edba2014-12-01 14:53:08 -080034if (CLANG_ENABLE_ARCMT)
35 list(APPEND CLANG_TEST_DEPS
36 arcmt-test
37 c-arcmt-test
38 )
39endif ()
40
Stephen Hinesc568f1e2014-07-21 00:47:37 -070041if (ENABLE_CLANG_EXAMPLES)
42 list(APPEND CLANG_TEST_DEPS
43 clang-interpreter
44 PrintFunctionNames
Stephen Hines176edba2014-12-01 14:53:08 -080045 )
46endif ()
47
48if (ENABLE_CLANG_STATIC_ANALYZER AND ENABLE_CLANG_EXAMPLES)
49 list(APPEND CLANG_TEST_DEPS
Stephen Hinesc568f1e2014-07-21 00:47:37 -070050 SampleAnalyzerPlugin
51 )
52endif ()
53
Jordan Rose6bbaa772013-02-08 07:28:25 +000054set(CLANG_TEST_PARAMS
55 clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
56 )
Chandler Carruth82a53bd2012-06-30 10:14:27 +000057
Jordan Rose6bbaa772013-02-08 07:28:25 +000058if( NOT CLANG_BUILT_STANDALONE )
59 list(APPEND CLANG_TEST_DEPS
Stephen Hines651f13c2014-04-23 16:59:28 -070060 llvm-config
Stephen Hines6bcf27b2014-05-29 04:14:42 -070061 llc opt FileCheck count not llvm-symbolizer llvm-profdata
Chandler Carruth82a53bd2012-06-30 10:14:27 +000062 )
Daniel Dunbare9a73232009-11-03 07:25:53 +000063endif()
Chandler Carruth82a53bd2012-06-30 10:14:27 +000064
Stephen Hines651f13c2014-04-23 16:59:28 -070065add_lit_testsuite(check-clang "Running the Clang regression tests"
66 ${CMAKE_CURRENT_BINARY_DIR}
67 #LIT ${LLVM_LIT}
68 PARAMS ${CLANG_TEST_PARAMS}
69 DEPENDS ${CLANG_TEST_DEPS}
70 ARGS ${CLANG_TEST_EXTRA_ARGS}
71 )
72set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
73
Chandler Carruth82a53bd2012-06-30 10:14:27 +000074# Add a legacy target spelling: clang-test
Chandler Carruth4a263922012-07-02 21:46:03 +000075add_custom_target(clang-test)
76add_dependencies(clang-test check-clang)
Chandler Carruth82a53bd2012-06-30 10:14:27 +000077set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")