aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-02-08 07:28:25 +0000
committerJordan Rose <jordan_rose@apple.com>2013-02-08 07:28:25 +0000
commit6bbaa772515e5bd021f38358667746db40ae54d2 (patch)
treefe138422c4061225a1f27b9a0356d183c160fac8
parent63eb156f663a869af8f7360165f85ff31dc95d1f (diff)
CMake: Include Clang unit tests in check-clang target in standalone builds.
Also, remove CLANG_BUILD_TESTS option. It won't have consistent behavior between standalone and non-standalone builds, so I'm not going to bother hooking it up for standalone builds. LLVM_BUILD_TESTS will continue to control unit test inclusion in the "all" target in non-standalone builds. Finally, fix the default value of CLANG_INCLUDE_TESTS, which was being set to the boolean value of "LLVM_INCLUDE_TESTS", i.e. OFF, rather than actually reading the variable ${LLVM_INCLUDE_TESTS}! If you picked up my earlier commit, YOU WILL HAVE TO MANUALLY SET THIS OPTION BACK ON. My apologies! Part two of r174691 (allow the unit tests to be built in standalone mode). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174698 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt7
-rw-r--r--test/CMakeLists.txt44
2 files changed, 26 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1c8cec176..14fe46fe6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -279,17 +279,12 @@ add_subdirectory(examples)
# TODO: docs.
add_subdirectory(test)
-option(CLANG_BUILD_TESTS
- "Build Clang unit tests. If OFF, just generate build targets."
- LLVM_BUILD_TESTS)
option(CLANG_INCLUDE_TESTS
"Generate build targets for the Clang unit tests."
- LLVM_INCLUDE_TESTS)
+ ${LLVM_INCLUDE_TESTS})
if( CLANG_INCLUDE_TESTS )
add_subdirectory(unittests)
-elseif( CLANG_BUILD_TESTS )
- message(FATAL_ERROR "CLANG_BUILD_TESTS requires CLANG_INCLUDE_TESTS")
endif()
# Workaround for MSVS10 to avoid the Dialog Hell
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b8bec6258f..8da2ba4ab4 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -26,24 +26,27 @@ if(CLANG_TEST_USE_VG)
set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
endif ()
-if( NOT CLANG_BUILT_STANDALONE )
+set(CLANG_TEST_DEPS
+ clang clang-headers
+ c-index-test diagtool arcmt-test c-arcmt-test
+ clang-check
+ )
+set(CLANG_TEST_PARAMS
+ clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+ )
- set(CLANG_TEST_DEPS
- clang clang-headers
- c-index-test diagtool arcmt-test c-arcmt-test
- clang-check
- llc opt FileCheck count not
+if(CLANG_INCLUDE_TESTS)
+ list(APPEND CLANG_TEST_DEPS ClangUnitTests)
+ list(APPEND CLANG_TEST_PARAMS
+ clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
)
- set(CLANG_TEST_PARAMS
- clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+endif()
+
+if( NOT CLANG_BUILT_STANDALONE )
+ list(APPEND CLANG_TEST_DEPS
+ llc opt FileCheck count not
)
- if(LLVM_INCLUDE_TESTS)
- list(APPEND CLANG_TEST_DEPS ClangUnitTests)
- list(APPEND CLANG_TEST_PARAMS
- clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
- )
- endif()
add_lit_testsuite(check-clang "Running the Clang regression tests"
${CMAKE_CURRENT_BINARY_DIR}
PARAMS ${CLANG_TEST_PARAMS}
@@ -68,18 +71,21 @@ else()
set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
separate_arguments(LIT_ARGS)
+
+ list(APPEND CLANG_TEST_PARAMS build_mode=${CMAKE_CFG_INTDIR})
+
+ foreach(param ${CLANG_TEST_PARAMS})
+ list(APPEND LIT_ARGS --param ${param})
+ endforeach()
add_custom_target(check-clang
COMMAND ${PYTHON_EXECUTABLE}
${LIT}
- --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
- --param build_mode=${CMAKE_CFG_INTDIR}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
+ ${CLANG_TEST_EXTRA_ARGS}
COMMENT "Running Clang regression tests"
- DEPENDS clang clang-headers
- c-index-test diagtool arcmt-test c-arcmt-test
- clang-check
+ DEPENDS ${CLANG_TEST_DEPS}
)
set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
endif()