diff options
author | Brad King <brad.king@kitware.com> | 2023-05-03 14:29:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-05-04 20:58:03 (GMT) |
commit | 39a20a56ddcde1eecd44b32ab0610b579a7ac4eb (patch) | |
tree | 7d6c24f1bb4afe447c121697752d22e8c4a35bb1 /Tests | |
parent | cd4038fe94caa6f9a18291081a6e8801b91a2368 (diff) | |
download | CMake-39a20a56ddcde1eecd44b32ab0610b579a7ac4eb.zip CMake-39a20a56ddcde1eecd44b32ab0610b579a7ac4eb.tar.gz CMake-39a20a56ddcde1eecd44b32ab0610b579a7ac4eb.tar.bz2 |
Tests: Move `CTestTestZeroTimeout` into `RunCMake.CTestTimeout`
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/CTestTestZeroTimeout/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/CTestTestZeroTimeout/CTestConfig.cmake | 4 | ||||
-rw-r--r-- | Tests/CTestTestZeroTimeout/sleep.c | 16 | ||||
-rw-r--r-- | Tests/CTestTestZeroTimeout/test.cmake.in | 22 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CTestTimeout/CMakeLists.txt.in | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/CTestTimeout/ZeroOverridesVar-stdout.txt | 6 |
9 files changed, 22 insertions, 64 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index e3b5ec4..2fa962e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3192,17 +3192,6 @@ if(BUILD_TESTING) WORKING_DIRECTORY ${CMake_BINARY_DIR}/Tests/CTestTestTimeout) configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestZeroTimeout/test.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" - @ONLY ESCAPE_QUOTES) - add_test(CTestTestZeroTimeout ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" -V - --output-log - "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/testOutput.log") - set_tests_properties(CTestTestZeroTimeout PROPERTIES - FAIL_REGULAR_EXPRESSION "\\*\\*\\*Timeout") - - configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestDepends/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestDepends/test.cmake" @ONLY ESCAPE_QUOTES) diff --git a/Tests/CTestTestZeroTimeout/CMakeLists.txt b/Tests/CTestTestZeroTimeout/CMakeLists.txt deleted file mode 100644 index 51ef807..0000000 --- a/Tests/CTestTestZeroTimeout/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required (VERSION 3.5) -project (CTestTestZeroTimeout) -include (CTest) - -add_executable (Sleep sleep.c) - -add_test (TestExplicitZeroTimeout Sleep) -set_tests_properties(TestExplicitZeroTimeout PROPERTIES TIMEOUT 0) diff --git a/Tests/CTestTestZeroTimeout/CTestConfig.cmake b/Tests/CTestTestZeroTimeout/CTestConfig.cmake deleted file mode 100644 index bd265f9..0000000 --- a/Tests/CTestTestZeroTimeout/CTestConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "open.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") diff --git a/Tests/CTestTestZeroTimeout/sleep.c b/Tests/CTestTestZeroTimeout/sleep.c deleted file mode 100644 index 5d0b89b..0000000 --- a/Tests/CTestTestZeroTimeout/sleep.c +++ /dev/null @@ -1,16 +0,0 @@ -#if defined(_WIN32) -# include <windows.h> -#else -# include <unistd.h> -#endif - -/* sleeps for 5 seconds */ -int main(int argc, char** argv) -{ -#if defined(_WIN32) - Sleep(5000); -#else - sleep(5); -#endif - return 0; -} diff --git a/Tests/CTestTestZeroTimeout/test.cmake.in b/Tests/CTestTestZeroTimeout/test.cmake.in deleted file mode 100644 index e0dbbc6..0000000 --- a/Tests/CTestTestZeroTimeout/test.cmake.in +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ZeroTimeout") - -set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestZeroTimeout") -set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestZeroTimeout") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") -set(CTEST_TEST_TIMEOUT 2) - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index ada9132..3007660 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -562,7 +562,10 @@ add_RunCMake_test(alias_targets) add_RunCMake_test(InterfaceLibrary) add_RunCMake_test(no_install_prefix) add_RunCMake_test(configure_file) -add_RunCMake_test(CTestTimeout -DTIMEOUT=${CTestTestTimeout_TIME}) +if(CTestTestTimeout_TIME) + set(CTestTimeout_ARGS -DTIMEOUT=${CTestTestTimeout_TIME}) +endif() +add_RunCMake_test(CTestTimeout) add_RunCMake_test(CTestTimeoutAfterMatch) if(CMake_TEST_CUDA) add_RunCMake_test(CUDA_architectures) diff --git a/Tests/RunCMake/CTestTimeout/CMakeLists.txt.in b/Tests/RunCMake/CTestTimeout/CMakeLists.txt.in index 20faa94..ee3323c 100644 --- a/Tests/RunCMake/CTestTimeout/CMakeLists.txt.in +++ b/Tests/RunCMake/CTestTimeout/CMakeLists.txt.in @@ -4,7 +4,7 @@ include(CTest) add_executable(TestTimeout TestTimeout.c) -if(NOT TIMEOUT) +if(NOT DEFINED TIMEOUT) set(TIMEOUT 4) endif() target_compile_definitions(TestTimeout PRIVATE TIMEOUT=${TIMEOUT}) diff --git a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake index 7e96b6d..e55ba27 100644 --- a/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestTimeout/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCTest) -if(NOT TIMEOUT) +if(NOT DEFINED TIMEOUT) # Give the process time to load and start running. set(TIMEOUT 4) endif() @@ -20,3 +20,13 @@ if(UNIX) run_ctest_timeout(Fork) unset(CASE_CMAKELISTS_SUFFIX_CODE) endif() + +block() + # An explicit zero TIMEOUT test property means "no timeout". + set(TIMEOUT 0) + # The test sleeps for 4 seconds longer than the TIMEOUT value. + # Set a default timeout to less than that so that the test will + # timeout if the zero TIMEOUT does not suppress it. + set(CASE_TEST_PREFIX_CODE "set(CTEST_TEST_TIMEOUT 2)") + run_ctest_timeout(ZeroOverridesVar) +endblock() diff --git a/Tests/RunCMake/CTestTimeout/ZeroOverridesVar-stdout.txt b/Tests/RunCMake/CTestTimeout/ZeroOverridesVar-stdout.txt new file mode 100644 index 0000000..7192055 --- /dev/null +++ b/Tests/RunCMake/CTestTimeout/ZeroOverridesVar-stdout.txt @@ -0,0 +1,6 @@ +Test project [^ +]*/Tests/RunCMake/CTestTimeout/ZeroOverridesVar-build + Start 1: TestTimeout +1/1 Test #1: TestTimeout ...................... Passed +[1-9][0-9.]* sec ++ +100% tests passed, 0 tests failed out of 1 |