cmCTestMultiProcessHandler: Simplify logic on unavailable resources

Deallocation is not necessary after allocation fails.
This commit is contained in:
Brad King
2023-11-15 15:36:46 -05:00
parent a4b061a035
commit 5d2e93f9e8

View File

@@ -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<std::string, std::vector<cmCTestBinPackerAllocation>> 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;
}