Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 1 | set(CLANG_TEST_DIRECTORIES |
| 2 | "Analysis" |
Douglas Gregor | 81b747b | 2009-09-17 21:32:03 +0000 | [diff] [blame] | 3 | "CodeCompletion" |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 4 | "CodeGen" |
Peter Collingbourne | 744d90b | 2011-10-06 16:49:54 +0000 | [diff] [blame] | 5 | "CodeGenCUDA" |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 6 | "CodeGenCXX" |
| 7 | "CodeGenObjC" |
Peter Collingbourne | f315fa8 | 2011-02-14 01:42:53 +0000 | [diff] [blame] | 8 | "CodeGenOpenCL" |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 9 | "Coverage" |
Douglas Gregor | ebfc180 | 2009-06-16 20:13:51 +0000 | [diff] [blame] | 10 | "CXX" |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 11 | "Driver" |
| 12 | "FixIt" |
| 13 | "Frontend" |
Ted Kremenek | f7507f2 | 2010-03-08 23:38:27 +0000 | [diff] [blame] | 14 | "Headers" |
Douglas Gregor | 2e22253 | 2009-07-02 17:08:52 +0000 | [diff] [blame] | 15 | "Index" |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 16 | "Lexer" |
| 17 | "Misc" |
| 18 | "PCH" |
| 19 | "Parser" |
| 20 | "Preprocessor" |
| 21 | "Rewriter" |
| 22 | "Sema" |
Peter Collingbourne | ced7671 | 2010-12-01 03:15:31 +0000 | [diff] [blame] | 23 | "SemaCUDA" |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 24 | "SemaCXX" |
| 25 | "SemaObjC" |
| 26 | "SemaObjCXX" |
Peter Collingbourne | 39d3e7a | 2011-02-15 19:46:23 +0000 | [diff] [blame] | 27 | "SemaOpenCL" |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 28 | "SemaTemplate") |
Douglas Gregor | eb357b6 | 2009-06-05 16:00:31 +0000 | [diff] [blame] | 29 | |
Daniel Dunbar | 1e63492 | 2009-11-07 23:53:32 +0000 | [diff] [blame] | 30 | set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}") |
| 31 | set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}") |
Andrew Trick | 7140b3c | 2011-06-23 18:00:48 +0000 | [diff] [blame] | 32 | set(LLVM_BUILD_MODE "%(build_mode)s") |
Daniel Dunbar | 30eb055 | 2009-11-08 09:46:39 +0000 | [diff] [blame] | 33 | set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s") |
| 34 | set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s") |
Daniel Dunbar | 1e63492 | 2009-11-07 23:53:32 +0000 | [diff] [blame] | 35 | set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") |
| 36 | set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..") |
NAKAMURA Takumi | c3189e9 | 2011-02-03 09:01:12 +0000 | [diff] [blame] | 37 | if(BUILD_SHARED_LIBS) |
| 38 | set(ENABLE_SHARED 1) |
| 39 | else() |
| 40 | set(ENABLE_SHARED 0) |
| 41 | endif(BUILD_SHARED_LIBS) |
Daniel Dunbar | 1e63492 | 2009-11-07 23:53:32 +0000 | [diff] [blame] | 42 | |
| 43 | configure_file( |
| 44 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in |
| 45 | ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) |
| 46 | |
NAKAMURA Takumi | c3189e9 | 2011-02-03 09:01:12 +0000 | [diff] [blame] | 47 | configure_file( |
| 48 | ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in |
| 49 | ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg |
| 50 | @ONLY) |
| 51 | |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 52 | include(FindPythonInterp) |
| 53 | if(PYTHONINTERP_FOUND) |
Oscar Fuentes | 57ca32b | 2011-02-05 19:08:56 +0000 | [diff] [blame] | 54 | if( LLVM_MAIN_SRC_DIR ) |
| 55 | set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py") |
| 56 | else() |
Oscar Fuentes | ba43a4d | 2011-02-05 21:37:51 +0000 | [diff] [blame] | 57 | set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit") |
NAKAMURA Takumi | 378d2a1 | 2011-02-23 12:07:49 +0000 | [diff] [blame] | 58 | # Installed LLVM does not contain ${CMAKE_CFG_INTDIR} in paths. |
| 59 | if( NOT EXISTS ${LIT} ) |
| 60 | set(LIT "${PATH_TO_LLVM_BUILD}/bin/llvm-lit") |
| 61 | endif() |
Oscar Fuentes | 57ca32b | 2011-02-05 19:08:56 +0000 | [diff] [blame] | 62 | endif() |
| 63 | |
Oscar Fuentes | ba43a4d | 2011-02-05 21:37:51 +0000 | [diff] [blame] | 64 | if( PATH_TO_LLVM_BUILD ) |
| 65 | set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}") |
| 66 | endif() |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 67 | |
Daniel Dunbar | e33f82f | 2009-11-22 21:55:22 +0000 | [diff] [blame] | 68 | option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF) |
| 69 | if(CLANG_TEST_USE_VG) |
| 70 | set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg") |
| 71 | endif () |
| 72 | |
NAKAMURA Takumi | c84aca4 | 2010-11-11 04:09:51 +0000 | [diff] [blame] | 73 | set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}") |
| 74 | separate_arguments(LIT_ARGS) |
| 75 | |
Jeffrey Yasskin | 718b01d | 2011-02-15 07:54:28 +0000 | [diff] [blame] | 76 | add_custom_target(clang-test.deps) |
Oscar Fuentes | a3f787c | 2011-02-20 22:06:44 +0000 | [diff] [blame] | 77 | set_target_properties(clang-test.deps PROPERTIES FOLDER "Clang tests") |
Jeffrey Yasskin | 718b01d | 2011-02-15 07:54:28 +0000 | [diff] [blame] | 78 | |
Douglas Gregor | 7986519 | 2009-06-05 23:57:17 +0000 | [diff] [blame] | 79 | add_custom_target(clang-test |
Daniel Dunbar | e9a7323 | 2009-11-03 07:25:53 +0000 | [diff] [blame] | 80 | COMMAND ${PYTHON_EXECUTABLE} |
Oscar Fuentes | 57ca32b | 2011-02-05 19:08:56 +0000 | [diff] [blame] | 81 | ${LIT} |
Daniel Dunbar | b258d8f | 2009-11-05 16:36:19 +0000 | [diff] [blame] | 82 | --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg |
Jeffrey Yasskin | 718b01d | 2011-02-15 07:54:28 +0000 | [diff] [blame] | 83 | --param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg |
Daniel Dunbar | 1e63492 | 2009-11-07 23:53:32 +0000 | [diff] [blame] | 84 | --param build_config=${CMAKE_CFG_INTDIR} |
Jeffrey Yasskin | 718b01d | 2011-02-15 07:54:28 +0000 | [diff] [blame] | 85 | --param build_mode=${RUNTIME_BUILD_MODE} |
NAKAMURA Takumi | c84aca4 | 2010-11-11 04:09:51 +0000 | [diff] [blame] | 86 | ${LIT_ARGS} |
Daniel Dunbar | 7af18d3 | 2009-09-17 19:55:53 +0000 | [diff] [blame] | 87 | ${CMAKE_CURRENT_BINARY_DIR} |
Daniel Dunbar | 7af18d3 | 2009-09-17 19:55:53 +0000 | [diff] [blame] | 88 | COMMENT "Running Clang regression tests") |
Daniel Dunbar | cceef8b | 2009-09-22 10:07:55 +0000 | [diff] [blame] | 89 | |
Jeffrey Yasskin | 718b01d | 2011-02-15 07:54:28 +0000 | [diff] [blame] | 90 | if( NOT CLANG_BUILT_STANDALONE ) |
NAKAMURA Takumi | 582c1fb | 2011-07-20 16:35:49 +0000 | [diff] [blame] | 91 | add_custom_target(check-all |
Jeffrey Yasskin | 718b01d | 2011-02-15 07:54:28 +0000 | [diff] [blame] | 92 | COMMAND ${PYTHON_EXECUTABLE} |
Oscar Fuentes | 57ca32b | 2011-02-05 19:08:56 +0000 | [diff] [blame] | 93 | ${LIT} |
NAKAMURA Takumi | 3aa8c64 | 2010-11-29 01:18:56 +0000 | [diff] [blame] | 94 | --param build_config=${CMAKE_CFG_INTDIR} |
| 95 | --param build_mode=${RUNTIME_BUILD_MODE} |
| 96 | ${LIT_ARGS} |
| 97 | ${LLVM_BINARY_DIR}/test |
| 98 | ${CMAKE_CURRENT_BINARY_DIR} |
| 99 | COMMENT "Running Clang and LLVM regression tests") |
Douglas Gregor | fc71ac8 | 2011-07-15 21:03:20 +0000 | [diff] [blame] | 100 | add_dependencies(check-all clang-test.deps) |
Douglas Gregor | 02bba19 | 2011-02-25 00:43:05 +0000 | [diff] [blame] | 101 | if ( LLVM_INCLUDE_TESTS ) |
NAKAMURA Takumi | a47027b | 2011-08-16 03:45:31 +0000 | [diff] [blame] | 102 | add_dependencies(clang-test.deps ClangUnitTests) |
| 103 | add_dependencies(check-all check.deps) |
Douglas Gregor | 02bba19 | 2011-02-25 00:43:05 +0000 | [diff] [blame] | 104 | endif ( LLVM_INCLUDE_TESTS ) |
NAKAMURA Takumi | 652f1ef | 2011-02-16 03:07:10 +0000 | [diff] [blame] | 105 | add_dependencies(clang-test.deps |
NAKAMURA Takumi | 582c1fb | 2011-07-20 16:35:49 +0000 | [diff] [blame] | 106 | llvm-dis llc opt |
NAKAMURA Takumi | 652f1ef | 2011-02-16 03:07:10 +0000 | [diff] [blame] | 107 | FileCheck count not |
| 108 | ) |
NAKAMURA Takumi | 582c1fb | 2011-07-20 16:35:49 +0000 | [diff] [blame] | 109 | endif() |
NAKAMURA Takumi | f0d9d8b | 2010-12-10 02:58:03 +0000 | [diff] [blame] | 110 | |
| 111 | add_dependencies(clang-test clang-test.deps) |
| 112 | add_dependencies(clang-test.deps |
Ted Kremenek | 8425126 | 2011-08-11 22:06:55 +0000 | [diff] [blame] | 113 | clang clang-headers c-index-test diagtool arcmt-test c-arcmt-test |
NAKAMURA Takumi | 652f1ef | 2011-02-16 03:07:10 +0000 | [diff] [blame] | 114 | ) |
NAKAMURA Takumi | f0d9d8b | 2010-12-10 02:58:03 +0000 | [diff] [blame] | 115 | |
Daniel Dunbar | e9a7323 | 2009-11-03 07:25:53 +0000 | [diff] [blame] | 116 | endif() |