From 5d2e93f9e8e775c210285e63deb5377f2114b851 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Nov 2023 15:36:46 -0500 Subject: cmCTestMultiProcessHandler: Simplify logic on unavailable resources Deallocation is not necessary after allocation fails. --- Source/CTest/cmCTestMultiProcessHandler.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 67bbb4a..b91f07c 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -256,6 +256,12 @@ bool cmCTestMultiProcessHandler::AllocateResources(int index) return true; } + // If the test needs unavailable resources then do not allocate anything + // because it will never run. We will issue the recorded errors instead. + if (!this->ResourceAvailabilityErrors[index].empty()) { + return true; + } + std::map> allocations; if (!this->TryAllocateResources(index, allocations)) { return false; @@ -454,10 +460,7 @@ bool cmCTestMultiProcessHandler::StartTest(int test) } } - // Allocate resources - if (this->ResourceAvailabilityErrors[test].empty() && - !this->AllocateResources(test)) { - this->DeallocateResources(test); + if (!this->AllocateResources(test)) { return false; } -- cgit v0.12