[cfe-commits] [PATCH] Add CMake support to the clang unittests (issue4152043)
NAKAMURA Takumi
geek4civic at gmail.com
Wed Feb 9 22:21:53 PST 2011
Jeffrey, here is an additional patch, to suppress unittests for now.
Checked on centos5.
...Takumi
-------------- next part --------------
commit 910a463f8014a8693d204c5d20ebc58bbaf5abb3
Author: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Thu Feb 10 15:13:53 2011 +0900
CMake: Exclude unittests for standalone build.
FIXME: You will see "warning: test suite 'Clang-Unit' contained no tests".
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 949ad25..a43aa42 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
add_definitions( -D__STDC_LIMIT_MACROS )
add_definitions( -D__STDC_CONSTANT_MACROS )
+
+ set( CLANG_BUILT_STANDALONE 1 )
endif()
set(CLANG_RESOURCE_DIR "" CACHE STRING
@@ -213,4 +215,8 @@ add_subdirectory(runtime)
# TODO: docs.
add_subdirectory(test)
-add_subdirectory(unittests)
+
+# FIXME: unittests require gtest.
+if( NOT CLANG_BUILT_STANDALONE )
+ add_subdirectory(unittests)
+endif()
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7167257..ef4997e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -66,14 +66,14 @@ if(PYTHONINTERP_FOUND)
set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
separate_arguments(LIT_ARGS)
+ add_custom_target(clang-test.deps)
+
foreach(testdir ${CLANG_TEST_DIRECTORIES})
add_custom_target(clang-test-${testdir}
COMMAND ${PYTHON_EXECUTABLE}
${LIT}
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
- --param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
- --param build_mode=${RUNTIME_BUILD_MODE}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}/${testdir}
DEPENDS clang c-index-test FileCheck not count
@@ -95,16 +95,15 @@ if(PYTHONINTERP_FOUND)
COMMAND ${PYTHON_EXECUTABLE}
${LIT}
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
- --param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
- --param build_mode=${RUNTIME_BUILD_MODE}
${LIT_ARGS}
${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests
DEPENDS clang c-index-test FileCheck not count
COMMENT "Running Clang regression tests")
- add_custom_target(check-all
- COMMAND ${PYTHON_EXECUTABLE}
+ if( NOT CLANG_BUILT_STANDALONE )
+ add_custom_target(check-all
+ COMMAND ${PYTHON_EXECUTABLE}
${LIT}
--param build_config=${CMAKE_CFG_INTDIR}
--param build_mode=${RUNTIME_BUILD_MODE}
@@ -112,16 +111,14 @@ if(PYTHONINTERP_FOUND)
${LLVM_BINARY_DIR}/test
${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running Clang and LLVM regression tests")
-
- add_custom_target(clang-test.deps)
+ add_dependencies(check-all check.deps clang-test.deps)
+ add_dependencies(clang-test.deps ClangUnitTests)
+ endif()
add_dependencies(clang-test clang-test.deps)
add_dependencies(clang-test.deps
- ClangUnitTests
clang clang-headers c-index-test
llvm-dis opt
FileCheck count not)
- add_dependencies(check-all check.deps clang-test.deps)
-
endif()
More information about the cfe-commits
mailing list