diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2013-10-29 21:29:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-10-31 13:29:55 (GMT) |
commit | 4fcb97eaac5de1cdd4adc86ac757ce68b37c9858 (patch) | |
tree | 2d83816069cb75ff469eea71f5db8f1cc4966051 | |
parent | 05c70424f6fb3aac890f50aec067b60e997113b1 (diff) | |
download | CMake-4fcb97eaac5de1cdd4adc86ac757ce68b37c9858.zip CMake-4fcb97eaac5de1cdd4adc86ac757ce68b37c9858.tar.gz CMake-4fcb97eaac5de1cdd4adc86ac757ce68b37c9858.tar.bz2 |
Tests: Add test for CTEST_USE_LAUNCHERS capture of custom commands
This new test detects if custom command failures are detected with
launchers.
-rw-r--r-- | Tests/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt | 19 | ||||
-rw-r--r-- | Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake | 8 | ||||
-rw-r--r-- | Tests/CTestTestLaunchers/launcher_test_project/command.cmake | 5 | ||||
-rw-r--r-- | Tests/CTestTestLaunchers/test.cmake.in | 39 |
5 files changed, 82 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4b08c88..7c939ed 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2344,6 +2344,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" ) + if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefiles" OR "${CMAKE_TEST_GENERATOR}" MATCHES "Ninja") + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestLaunchers/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" @ONLY ESCAPE_QUOTES) + add_test(CTestTestLaunchers ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/testOutput.log" + ) + set_tests_properties(CTestTestLaunchers PROPERTIES + PASS_REGULAR_EXPRESSION "CTEST_TEST_LAUNCHER_SUCCESS") + endif() + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestChecksum/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/test.cmake" @ONLY ESCAPE_QUOTES) diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt b/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt new file mode 100644 index 0000000..06c5725 --- /dev/null +++ b/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(launcher_test_project) + +include(CTest) + +add_custom_command( + OUTPUT test1.txt + COMMAND ${CMAKE_COMMAND} + ARGS -DTESTID=1 -P "${CMAKE_CURRENT_SOURCE_DIR}/command.cmake" +) + +add_custom_command( + OUTPUT test2.txt + COMMAND ${CMAKE_COMMAND} + ARGS -DTESTID=2 -P "${CMAKE_CURRENT_SOURCE_DIR}/command.cmake" +) + +add_custom_target(mytarget ALL DEPENDS test1.txt test2.txt) diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake new file mode 100644 index 0000000..bf404ab --- /dev/null +++ b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake @@ -0,0 +1,8 @@ +set(CTEST_USE_LAUNCHERS 1) +set(CTEST_PROJECT_NAME "CTestTestLaunchers") +set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set(CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestLaunchers/launcher_test_project/command.cmake b/Tests/CTestTestLaunchers/launcher_test_project/command.cmake new file mode 100644 index 0000000..7f31af9 --- /dev/null +++ b/Tests/CTestTestLaunchers/launcher_test_project/command.cmake @@ -0,0 +1,5 @@ +if("${TESTID}" STREQUAL "1") + message("success") +elseif("${TESTID}" STREQUAL "2") + message(FATAL_ERROR "failure") +endif() diff --git a/Tests/CTestTestLaunchers/test.cmake.in b/Tests/CTestTestLaunchers/test.cmake.in new file mode 100644 index 0000000..43a6533 --- /dev/null +++ b/Tests/CTestTestLaunchers/test.cmake.in @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 2.8.12) + +# Settings: +set(CTEST_DASHBOARD_SOURCE "@CMake_SOURCE_DIR@/Tests/CTestTestLaunchers") +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTestLaunchers") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "Launchers-@BUILDNAME@-CTestTestLaunchers") + +set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_SOURCE}/launcher_test_project") +set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/launcher_test_project-bin") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + +file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " +CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ +CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ +CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@ +CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@ +CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@ +CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@ +") + +set(TEST_SUCCESS FALSE) + +ctest_start(Experimental) +ctest_configure(OPTIONS "-DCTEST_USE_LAUNCHERS=1") +ctest_build(NUMBER_ERRORS error_count) + +if("${error_count}" STREQUAL "1") + set(TEST_SUCCESS TRUE) +endif() + +if(TEST_SUCCESS) + message("CTEST_TEST_LAUNCHER_SUCCESS") +endif() |