From 0b2bdfa2898f4dd5beb0be5a7cf2964936ecda65 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Mon, 10 May 2004 18:06:11 -0400 Subject: [PATCH] ENH: Add some ctest coverage --- Source/CMakeLists.txt | 20 +++++---- Tests/CTestTest/CMakeLists.txt | 12 ++++++ Tests/CTestTest/test.cmake.in | 61 ++++++++++++++++++++++++++++ Tests/CommandLineTest/CMakeLists.txt | 19 +++++++++ 4 files changed, 103 insertions(+), 9 deletions(-) create mode 100644 Tests/CTestTest/CMakeLists.txt create mode 100644 Tests/CTestTest/test.cmake.in diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 37c7897bf..eef8ca3fa 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -597,17 +597,19 @@ IF(BUILD_TESTING) ) ENDIF (APPLE) - IF (UNIX_TEST_NOT_EXISTS) - CONFIGURE_FILE( - "${CMake_SOURCE_DIR}/Tests/CTestTest/ctest.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTest/ctest.cmake" - @ONLY - ) - ADD_TEST(CTestTest ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTest/ctest.cmake" -V + IF (CTEST_TEST_CTEST) + ADD_TEST(CTestTest ${CMAKE_CTEST_COMMAND} --force-new-ctest-process + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CTestTest" + "${CMake_BINARY_DIR}/Tests/CTestTest" + --build-generator ${CMAKE_GENERATOR} + --build-makeprogram ${MAKEPROGRAM} + --build-project CTestTest + --test-command ${CMAKE_CTEST_COMMAND} --force-new-ctest-process + -S "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" -V ) - ENDIF (UNIX_TEST_NOT_EXISTS) + ENDIF (CTEST_TEST_CTEST) IF (CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE OR WXWINDOWS_INCLUDE_DIR) diff --git a/Tests/CTestTest/CMakeLists.txt b/Tests/CTestTest/CMakeLists.txt new file mode 100644 index 000000000..d2ed0605a --- /dev/null +++ b/Tests/CTestTest/CMakeLists.txt @@ -0,0 +1,12 @@ +PROJECT(CTestTest) + +SET(DART_ROOT "" CACHE STRING "" FORCE) +ENABLE_TESTING() +INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake) + +GET_FILENAME_COMPONENT(CTEST_COMMAND "${CMAKE_COMMAND}" PATH) +SET(CTEST_COMMAND "${CTEST_COMMAND}/ctest") + + +CONFIGURE_FILE(${CTestTest_SOURCE_DIR}/test.cmake.in + ${CTestTest_BINARY_DIR}/test.cmake @ONLY) diff --git a/Tests/CTestTest/test.cmake.in b/Tests/CTestTest/test.cmake.in new file mode 100644 index 000000000..bae14bec2 --- /dev/null +++ b/Tests/CTestTest/test.cmake.in @@ -0,0 +1,61 @@ +# please see common.cmake for more documentation +################################################################### +# The values in this section must always be provided +################################################################### + +# this is the cvs module name that should be checked out +SET (CTEST_MODULE_NAME CMake) + +# these are the the name of the source and binary directory on disk. +# They will be appended to DASHBOARD_ROOT +SET (CTEST_SOURCE_NAME CMake) +SET (CTEST_BINARY_NAME CMakeBin) + +SET (CTEST_NOTES_FILE "@CMAKE_CURRENT_BINARY_DIR@/Note.txt") + +# which ctest command to use for running the dashboard +SET (CTEST_COMMAND + "@CTEST_COMMAND@ -T Start -T Configure -T Build -T Test -T Submit -M Experimental -A ${CTEST_NOTES_FILE} -R SystemInformation -E CTestTest" + ) + +# what cmake command to use for configuring this dashboard +SET (CTEST_CMAKE_COMMAND + "@CMAKE_COMMAND@" + ) + + +#################################################################### +# The values in this section are optional you can either +# have them or leave them commented out +#################################################################### + +# should ctest wipe the binary tree before running +SET (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) + +# this is the initial cache to use for the binary tree, be careful to escape +# any quotes inside of this string if you use it +SET (CTEST_INITIAL_CACHE " +SITE:STRING=TestingOfCTest +BUILDNAME:STRING=@BUILDNAME@ +CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ +CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ +DART_ROOT:PATH= +MAKECOMMAND:FILEPATH=@MAKECOMMAND@ +MEMORYCHECK_COMMAND:STRING= +") + +# if you do not want to use the default location for a +# dashboard then set this variable to the directory +# the dashboard should be in +SET (CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") + + +# set any extra envionment varibles here +SET (CTEST_ENVIRONMENT +) + +FILE(WRITE "${CTEST_NOTES_FILE}" + "This is a test of CTest\n") + +SET (CTEST_SOURCE_DIRECTORY "@CMAKE_ROOT@") +SET (CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/${CTEST_BINARY_NAME}") diff --git a/Tests/CommandLineTest/CMakeLists.txt b/Tests/CommandLineTest/CMakeLists.txt index 73b8a4788..624909289 100644 --- a/Tests/CommandLineTest/CMakeLists.txt +++ b/Tests/CommandLineTest/CMakeLists.txt @@ -9,7 +9,9 @@ EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E time \"${CMAKE_COMMAND} -N -LA ${CommandL EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E time \"${CMAKE_COMMAND} -N -LH ${CommandLineTest_SOURCE_DIR}\"") EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E time \"${CMAKE_COMMAND} -N -LAH ${CommandLineTest_SOURCE_DIR}\"") EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "--help") +EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "--help-command-list") EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "--help ADD_EXECUTABLE") +EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "--help-command ADD_EXECUTABLE") EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "--help-full \"${CMAKE_CURRENT_BINARY_DIR}/cmake.txt\"") EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "--help-man \"${CMAKE_CURRENT_BINARY_DIR}/cmake.man\"") EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "--help-html \"${CMAKE_CURRENT_BINARY_DIR}/cmake.html\"") @@ -24,6 +26,23 @@ ENDIF(DUMP_DOC_EXE) ADD_EXECUTABLE(CommandLineTest CommandLineTest.cxx) +GET_FILENAME_COMPONENT(CMAKE_COMMAND_PATH "${CMAKE_COMMAND}" PATH) +SET(CTEST_COMMAND "${CMAKE_COMMAND_PATH}/ctest") + +EXEC_PROGRAM(${CTEST_COMMAND} "${CMAKE_CURRENT_BINARY_DIR}/../.." ARGS "-N") +EXEC_PROGRAM(${CTEST_COMMAND} "${CMAKE_CURRENT_BINARY_DIR}/../.." ARGS "-R complex -N") +EXEC_PROGRAM(${CTEST_COMMAND} "${CMAKE_CURRENT_BINARY_DIR}/../.." ARGS "-E Simple -N") +EXEC_PROGRAM(${CTEST_COMMAND} "${CMAKE_CURRENT_BINARY_DIR}/../.." ARGS "-E Simple -N") +EXEC_PROGRAM(${CTEST_COMMAND} "${CMAKE_CURRENT_BINARY_DIR}/../.." ARGS "-N -I -10") +EXEC_PROGRAM(${CTEST_COMMAND} "${CMAKE_CURRENT_BINARY_DIR}/../.." ARGS "-N -I 10-") +EXEC_PROGRAM(${CTEST_COMMAND} "${CMAKE_CURRENT_BINARY_DIR}/../.." ARGS "-N -I 3,4") +EXEC_PROGRAM(${CTEST_COMMAND} ARGS "--help") +EXEC_PROGRAM(${CTEST_COMMAND} ARGS "--copyright") +EXEC_PROGRAM(${CTEST_COMMAND} ARGS "--help-full \"${CMAKE_CURRENT_BINARY_DIR}/ctest.txt\"") +EXEC_PROGRAM(${CTEST_COMMAND} ARGS "--help-man \"${CMAKE_CURRENT_BINARY_DIR}/ctest.man\"") +EXEC_PROGRAM(${CTEST_COMMAND} ARGS "--help-html \"${CMAKE_CURRENT_BINARY_DIR}/ctest.html\"") +EXEC_PROGRAM(${CTEST_COMMAND} ARGS "--version") + IF(THIS_SHOULD_BE_SET) MESSAGE(STATUS "***************************") MESSAGE(STATUS "PreLoad.cmake works fine.")