diff options
author | Brad King <brad.king@kitware.com> | 2023-11-15 20:36:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-11-17 23:43:01 (GMT) |
commit | 5d2e93f9e8e775c210285e63deb5377f2114b851 (patch) | |
tree | ed154263f60de39da6d378ee150f0376f87fe581 | |
parent | a4b061a035c782974642bf2ca2d8d5e1a2f94553 (diff) | |
download | CMake-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.cxx | 11 |
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; } |