Chandler Carruth | 82a53bd | 2012-06-30 10:14:27 +0000 | [diff] [blame] | 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. |
Douglas Gregor | eb357b6 | 2009-06-05 16:00:31 +0000 | [diff] [blame] | 3 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 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}) |
Daniel Dunbar | 1e63492 | 2009-11-07 23:53:32 +0000 | [diff] [blame] | 11 | |
Chandler Carruth | 65cf624 | 2012-06-29 00:39:23 +0000 | [diff] [blame] | 12 | configure_lit_site_cfg( |
Daniel Dunbar | 1e63492 | 2009-11-07 23:53:32 +0000 | [diff] [blame] | 13 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in |
Chandler Carruth | 65cf624 | 2012-06-29 00:39:23 +0000 | [diff] [blame] | 14 | ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg |
| 15 | ) |
Daniel Dunbar | 1e63492 | 2009-11-07 23:53:32 +0000 | [diff] [blame] | 16 | |
Chandler Carruth | 65cf624 | 2012-06-29 00:39:23 +0000 | [diff] [blame] | 17 | configure_lit_site_cfg( |
NAKAMURA Takumi | c3189e9 | 2011-02-03 09:01:12 +0000 | [diff] [blame] | 18 | ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in |
| 19 | ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg |
Chandler Carruth | 65cf624 | 2012-06-29 00:39:23 +0000 | [diff] [blame] | 20 | ) |
NAKAMURA Takumi | c3189e9 | 2011-02-03 09:01:12 +0000 | [diff] [blame] | 21 | |
Chandler Carruth | 82a53bd | 2012-06-30 10:14:27 +0000 | [diff] [blame] | 22 | option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF) |
| 23 | if(CLANG_TEST_USE_VG) |
| 24 | set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg") |
| 25 | endif () |
| 26 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 27 | list(APPEND CLANG_TEST_DEPS |
Jordan Rose | 6bbaa77 | 2013-02-08 07:28:25 +0000 | [diff] [blame] | 28 | clang clang-headers |
| 29 | c-index-test diagtool arcmt-test c-arcmt-test |
Daniel Jasper | 0ff72fc | 2013-03-25 09:14:25 +0000 | [diff] [blame] | 30 | clang-check clang-format |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 31 | clang-tblgen |
Jordan Rose | 6bbaa77 | 2013-02-08 07:28:25 +0000 | [diff] [blame] | 32 | ) |
Stephen Hines | c568f1e | 2014-07-21 00:47:37 -0700 | [diff] [blame^] | 33 | |
| 34 | if (ENABLE_CLANG_EXAMPLES) |
| 35 | list(APPEND CLANG_TEST_DEPS |
| 36 | clang-interpreter |
| 37 | PrintFunctionNames |
| 38 | SampleAnalyzerPlugin |
| 39 | ) |
| 40 | endif () |
| 41 | |
Jordan Rose | 6bbaa77 | 2013-02-08 07:28:25 +0000 | [diff] [blame] | 42 | set(CLANG_TEST_PARAMS |
| 43 | clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg |
| 44 | ) |
Chandler Carruth | 82a53bd | 2012-06-30 10:14:27 +0000 | [diff] [blame] | 45 | |
Jordan Rose | 6bbaa77 | 2013-02-08 07:28:25 +0000 | [diff] [blame] | 46 | if( NOT CLANG_BUILT_STANDALONE ) |
| 47 | list(APPEND CLANG_TEST_DEPS |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 48 | llvm-config |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 49 | llc opt FileCheck count not llvm-symbolizer llvm-profdata |
Chandler Carruth | 82a53bd | 2012-06-30 10:14:27 +0000 | [diff] [blame] | 50 | ) |
Daniel Dunbar | e9a7323 | 2009-11-03 07:25:53 +0000 | [diff] [blame] | 51 | endif() |
Chandler Carruth | 82a53bd | 2012-06-30 10:14:27 +0000 | [diff] [blame] | 52 | |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 53 | add_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 | ) |
| 60 | set_target_properties(check-clang PROPERTIES FOLDER "Clang tests") |
| 61 | |
Chandler Carruth | 82a53bd | 2012-06-30 10:14:27 +0000 | [diff] [blame] | 62 | # Add a legacy target spelling: clang-test |
Chandler Carruth | 4a26392 | 2012-07-02 21:46:03 +0000 | [diff] [blame] | 63 | add_custom_target(clang-test) |
| 64 | add_dependencies(clang-test check-clang) |
Chandler Carruth | 82a53bd | 2012-06-30 10:14:27 +0000 | [diff] [blame] | 65 | set_target_properties(clang-test PROPERTIES FOLDER "Clang tests") |