ENH: Re-enable new 'testing' test mode

This fixes selection of a configuration when none is specified to find
an available configuration of the ctest test-command.
This commit is contained in:
Brad King 2009-01-05 14:14:25 -05:00
parent 2703d51b8f
commit b5f3d4be61
3 changed files with 36 additions and 22 deletions

View File

@ -14,9 +14,11 @@ MACRO(ADD_TEST_MACRO NAME COMMAND)
ENDMACRO(ADD_TEST_MACRO) ENDMACRO(ADD_TEST_MACRO)
# Make sure the 'testing' test gets a proper configuration. # Make sure the 'testing' test gets a proper configuration.
#SET_DIRECTORY_PROPERTIES(PROPERTIES CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
# TEST_INCLUDE_FILE "${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake" ${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY)
# ) SET_DIRECTORY_PROPERTIES(PROPERTIES
TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake"
)
# Testing # Testing
IF(BUILD_TESTING) IF(BUILD_TESTING)
@ -542,16 +544,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
ENDFOREACH(STP) ENDFOREACH(STP)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial")
ADD_TEST(testing ${CMAKE_CTEST_COMMAND} # -C \${CTEST_CONFIGURATION_TYPE} ADD_TEST(testing ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/Testing" "${CMake_SOURCE_DIR}/Tests/Testing"
"${CMake_BINARY_DIR}/Tests/Testing" "${CMake_BINARY_DIR}/Tests/Testing"
--build-generator ${CMAKE_TEST_GENERATOR} --build-generator ${CMAKE_TEST_GENERATOR}
--build-project Testing --build-project Testing
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
#--test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Testing/bin"
--test-command testing
) )
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing")

View File

@ -1,15 +0,0 @@
# Older versions of CMake do not support an empty configuration name in
# CTEST_CONFIGURATION_TYPE for the 'testing' test.
SET(CONFIG_REQUIRED)
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
SET(CONFIG_REQUIRED 1)
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6)
IF("${CMAKE_PATCH_VERSION}" LESS 3)
SET(CONFIG_REQUIRED 1)
ENDIF("${CMAKE_PATCH_VERSION}" LESS 3)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
IF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)
SET(CTEST_CONFIGURATION_TYPE Debug)
ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)

View File

@ -0,0 +1,29 @@
# Older versions of CMake do not support an empty configuration name in
# CTEST_CONFIGURATION_TYPE for the 'testing' test.
SET(CONFIG_REQUIRED)
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
SET(CONFIG_REQUIRED 1)
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6)
IF("${CMAKE_PATCH_VERSION}" LESS 3)
SET(CONFIG_REQUIRED 1)
ENDIF("${CMAKE_PATCH_VERSION}" LESS 3)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
IF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)
SET(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@")
GET_FILENAME_COMPONENT(CTEST_DIR "${CTEST_CMD}" PATH)
GET_FILENAME_COMPONENT(CTEST_EXE "${CTEST_CMD}" NAME)
FOREACH(cfg Release Debug MinSizeRel RelWithDebInfo)
IF(NOT CTEST_CONFIGURATION_TYPE)
IF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}")
SET(CTEST_CONFIGURATION_TYPE ${cfg})
ENDIF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}")
ENDIF(NOT CTEST_CONFIGURATION_TYPE)
ENDFOREACH(cfg)
IF(NOT CTEST_CONFIGURATION_TYPE)
SET(CTEST_CONFIGURATION_TYPE NoConfig)
ENDIF(NOT CTEST_CONFIGURATION_TYPE)
MESSAGE("Guessing configuration ${CTEST_CONFIGURATION_TYPE}")
ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)