blob: fe80df456490584071e0bedd6a0680d0661dc03e [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
29 c-index-test diagtool arcmt-test c-arcmt-test
Daniel Jasper0ff72fc2013-03-25 09:14:25 +000030 clang-check clang-format
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
34if (ENABLE_CLANG_EXAMPLES)
35 list(APPEND CLANG_TEST_DEPS
36 clang-interpreter
37 PrintFunctionNames
38 SampleAnalyzerPlugin
39 )
40endif ()
41
Jordan Rose6bbaa772013-02-08 07:28:25 +000042set(CLANG_TEST_PARAMS
43 clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
44 )
Chandler Carruth82a53bd2012-06-30 10:14:27 +000045
Jordan Rose6bbaa772013-02-08 07:28:25 +000046if( NOT CLANG_BUILT_STANDALONE )
47 list(APPEND CLANG_TEST_DEPS
Stephen Hines651f13c2014-04-23 16:59:28 -070048 llvm-config
Stephen Hines6bcf27b2014-05-29 04:14:42 -070049 llc opt FileCheck count not llvm-symbolizer llvm-profdata
Chandler Carruth82a53bd2012-06-30 10:14:27 +000050 )
Daniel Dunbare9a73232009-11-03 07:25:53 +000051endif()
Chandler Carruth82a53bd2012-06-30 10:14:27 +000052
Stephen Hines651f13c2014-04-23 16:59:28 -070053add_lit_testsuite(check-clang "Running the Clang regression tests"
54 ${CMAKE_CURRENT_BINARY_DIR}
55 #LIT ${LLVM_LIT}
56 PARAMS ${CLANG_TEST_PARAMS}
57 DEPENDS ${CLANG_TEST_DEPS}
58 ARGS ${CLANG_TEST_EXTRA_ARGS}
59 )
60set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
61
Chandler Carruth82a53bd2012-06-30 10:14:27 +000062# Add a legacy target spelling: clang-test
Chandler Carruth4a263922012-07-02 21:46:03 +000063add_custom_target(clang-test)
64add_dependencies(clang-test check-clang)
Chandler Carruth82a53bd2012-06-30 10:14:27 +000065set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")