Browse Source

Always use a configuration for CTestTestTimeout

This test requires that the dashboard script it drives be invoked with
"ctest -C <config> -S ...".  We create a "CTestTest_CONFIG" variable to
hold a configuration selected at test time.  We use the configuration
given to the outer CTest, if any, and then default to either Debug or
the CMAKE_BUILD_TYPE.
Brad King 16 years ago
parent
commit
7380d3ab7c
2 changed files with 14 additions and 1 deletions
  1. 7 1
      Tests/CMakeLists.txt
  2. 7 0
      Tests/EnforceConfig.cmake.in

+ 7 - 1
Tests/CMakeLists.txt

@@ -22,6 +22,12 @@ IF(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME)
 SET(ENV{HOME} \"${TEST_HOME}\")")
 ENDIF()
 
+# Choose a default configuration for CTest tests.
+SET(CTestTest_CONFIG Debug)
+IF(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE)
+  SET(CTestTest_CONFIG ${CMAKE_BUILD_TYPE})
+ENDIF()
+
 # Make sure the 'testing' test gets a proper configuration.
 CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
                ${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY)
@@ -1231,7 +1237,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
     "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake"
     @ONLY ESCAPE_QUOTES)
   ADD_TEST(CTestTestTimeout ${CMAKE_CTEST_COMMAND}
-    -C "\${CTEST_CONFIGURATION_TYPE}"
+    -C "\${CTestTest_CONFIG}"
     -S "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake" -V
     --output-log "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/testOutput.log"
     )

+ 7 - 0
Tests/EnforceConfig.cmake.in

@@ -1,3 +1,10 @@
+# Choose a configuration with which to drive CTest tests.
+IF(CTEST_CONFIGURATION_TYPE)
+  SET(CTestTest_CONFIG "${CTEST_CONFIGURATION_TYPE}")
+ELSE(CTEST_CONFIGURATION_TYPE)
+  SET(CTestTest_CONFIG "@CTestTest_CONFIG@")
+ENDIF(CTEST_CONFIGURATION_TYPE)
+
 # Older versions of CMake do not support an empty configuration name in
 # CTEST_CONFIGURATION_TYPE for the 'testing' test.
 SET(CONFIG_REQUIRED)