summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-11-15 20:36:46 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-17 23:43:01 (GMT)
commit5d2e93f9e8e775c210285e63deb5377f2114b851 (patch)
treeed154263f60de39da6d378ee150f0376f87fe581
parenta4b061a035c782974642bf2ca2d8d5e1a2f94553 (diff)
downloadCMake-5d2e93f9e8e775c210285e63deb5377f2114b851.zip
CMake-5d2e93f9e8e775c210285e63deb5377f2114b851.tar.gz
CMake-5d2e93f9e8e775c210285e63deb5377f2114b851.tar.bz2
cmCTestMultiProcessHandler: Simplify logic on unavailable resources
Deallocation is not necessary after allocation fails.
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx11
1 files 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<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;
}