diff options
author | Brad King <brad.king@kitware.com> | 2024-04-02 12:09:05 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-04-02 12:09:12 (GMT) |
commit | 659bc156eff0a90c2ea3fdb3d866e07f8c0e436b (patch) | |
tree | eb1a4af221baa4b6641d9e58538dd77f7814d5f6 /Tests | |
parent | 4629e6837ebf0bf11fd3f819dd61b95efb8b63ec (diff) | |
parent | 85745cce7aec38d9a7eaa83fb83ef3a7327fd6dc (diff) | |
download | CMake-659bc156eff0a90c2ea3fdb3d866e07f8c0e436b.zip CMake-659bc156eff0a90c2ea3fdb3d866e07f8c0e436b.tar.gz CMake-659bc156eff0a90c2ea3fdb3d866e07f8c0e436b.tar.bz2 |
Merge topic 'ctest-resource-lock' into release-3.29
85745cce7a ctest: Restore enforcement of RESOURCE_LOCK test property
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !9394
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/CTestTestResourceLock/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/CTestTestResourceLock/CTestConfig.cmake | 4 | ||||
-rw-r--r-- | Tests/CTestTestResourceLock/lockFile.c | 27 | ||||
-rw-r--r-- | Tests/CTestTestResourceLock/test.cmake.in | 21 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/ResourceLock-stdout.txt | 12 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 9 |
7 files changed, 21 insertions, 74 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ab31e70..72b55e0 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3104,15 +3104,6 @@ if(BUILD_TESTING) ) configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestResourceLock/test.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake" - @ONLY ESCAPE_QUOTES) - add_test(CTestTestResourceLock ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake" -V - --output-log "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/output.log" - ) - - configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestScheduler/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/test.cmake" @ONLY ESCAPE_QUOTES) diff --git a/Tests/CTestTestResourceLock/CMakeLists.txt b/Tests/CTestTestResourceLock/CMakeLists.txt deleted file mode 100644 index 683aba5..0000000 --- a/Tests/CTestTestResourceLock/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required (VERSION 3.5) -project(CTestTestResourceLock) -include(CTest) - -add_executable (LockFile lockFile.c) - -add_test (TestLockedFile1.1 LockFile locked1.txt) -add_test (TestLockedFile1.2 LockFile locked1.txt) -set_tests_properties(TestLockedFile1.1 TestLockedFile1.2 PROPERTIES RESOURCE_LOCK "locked1.txt") - -add_test (TestLockedFile2.1 LockFile locked2.txt) -add_test (TestLockedFile2.2 LockFile locked2.txt) -set_tests_properties(TestLockedFile2.1 TestLockedFile2.2 PROPERTIES RESOURCE_LOCK "locked2.txt") diff --git a/Tests/CTestTestResourceLock/CTestConfig.cmake b/Tests/CTestTestResourceLock/CTestConfig.cmake deleted file mode 100644 index bd265f9..0000000 --- a/Tests/CTestTestResourceLock/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/CTestTestResourceLock/lockFile.c b/Tests/CTestTestResourceLock/lockFile.c deleted file mode 100644 index 8c023ef..0000000 --- a/Tests/CTestTestResourceLock/lockFile.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <stdio.h> - -/* Disable deprecation warning for fopen */ -#pragma warning(disable : 4996) - -/*if run serially, works fine. - If run in parallel, someone will attempt to delete - a locked file, which will fail */ -int main(int argc, char** argv) -{ - FILE* file; - int i; - const char* fname; - if (argc >= 2) { - fname = argv[1]; - } else { - fname = "lockedFile.txt"; - } - file = fopen(fname, "w"); - - for (i = 0; i < 10000; i++) { - fprintf(file, "%s", "x"); - fflush(file); - } - fclose(file); - return remove(fname); -} diff --git a/Tests/CTestTestResourceLock/test.cmake.in b/Tests/CTestTestResourceLock/test.cmake.in deleted file mode 100644 index dab26fc..0000000 --- a/Tests/CTestTestResourceLock/test.cmake.in +++ /dev/null @@ -1,21 +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@-ResourceLock") - -set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestResourceLock") -set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestResourceLock") -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}") - -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 PARALLEL_LEVEL 4) diff --git a/Tests/RunCMake/ctest_test/ResourceLock-stdout.txt b/Tests/RunCMake/ctest_test/ResourceLock-stdout.txt new file mode 100644 index 0000000..c9b6253 --- /dev/null +++ b/Tests/RunCMake/ctest_test/ResourceLock-stdout.txt @@ -0,0 +1,12 @@ +Test project [^ +]*/Tests/RunCMake/ctest_test/ResourceLock-build + Start 2: test1 +1/4 Test #2: test1 ............................ Passed +[0-9.]+ sec + Start 3: test2 +2/4 Test #3: test2 ............................ Passed +[0-9.]+ sec + Start 4: test3 +3/4 Test #4: test3 ............................ Passed +[0-9.]+ sec + Start 5: test4 +4/4 Test #5: test4 ............................ Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 4 diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 3c9a80d..dd5c005 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -13,6 +13,15 @@ endfunction() run_ctest_test(TestQuiet QUIET) +set(CASE_CMAKELISTS_SUFFIX_CODE [[ +foreach(i RANGE 1 4) + add_test(NAME test${i} COMMAND ${CMAKE_COMMAND} -E true) + set_property(TEST test${i} PROPERTY RESOURCE_LOCK resource) +endforeach() +]]) +run_ctest_test(ResourceLock INCLUDE test PARALLEL_LEVEL 4) +unset(CASE_CMAKELISTS_SUFFIX_CODE) + set(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING} 4) set(CASE_CMAKELISTS_SUFFIX_CODE [[ foreach(i RANGE 1 6) |