summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-04-01 15:35:19 (GMT)
committerBrad King <brad.king@kitware.com>2024-04-01 16:22:29 (GMT)
commit85745cce7aec38d9a7eaa83fb83ef3a7327fd6dc (patch)
treeef2cf0ad4e0889d596f9f3e474262aa00aa89b35 /Source
parent951f75f3b2e0a31957c0c492ff2d5c7c51716106 (diff)
downloadCMake-85745cce7aec38d9a7eaa83fb83ef3a7327fd6dc.zip
CMake-85745cce7aec38d9a7eaa83fb83ef3a7327fd6dc.tar.gz
CMake-85745cce7aec38d9a7eaa83fb83ef3a7327fd6dc.tar.bz2
ctest: Restore enforcement of RESOURCE_LOCK test property
Refactoring in commit 5ff0b4ed57 (cmCTestMultiProcessHandler: Consolidate test readiness checks, 2023-10-20, v3.29.0-rc1~378^2~4) accidentally broke `RESOURCE_LOCK`. Fix it and replace the previous test with one that would have caught this. Fixes: #25843
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx15
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 53c5f76..773a305 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -442,6 +442,15 @@ void cmCTestMultiProcessHandler::SetStopTimePassed()
}
}
+bool cmCTestMultiProcessHandler::ResourceLocksAvailable(int test)
+{
+ return std::all_of(this->Properties[test]->ProjectResources.begin(),
+ this->Properties[test]->ProjectResources.end(),
+ [this](std::string const& r) -> bool {
+ return !cm::contains(this->ProjectResourcesLocked, r);
+ });
+}
+
void cmCTestMultiProcessHandler::LockResources(int index)
{
this->RunningCount += this->GetProcessorsUsed(index);
@@ -643,10 +652,8 @@ void cmCTestMultiProcessHandler::StartNextTests()
}
// Exclude tests that depend on currently-locked project resources.
- for (std::string const& i : this->Properties[test]->ProjectResources) {
- if (cm::contains(this->ProjectResourcesLocked, i)) {
- continue;
- }
+ if (!this->ResourceLocksAvailable(test)) {
+ continue;
}
// Allocate system resources needed by this test.
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index d4759f1..f491815 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -143,6 +143,7 @@ protected:
void InitializeLoop();
void FinalizeLoop();
+ bool ResourceLocksAvailable(int test);
void LockResources(int index);
void UnlockResources(int index);