From ee321dc85fcc99389c372f7ba1453edf27b27663 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 20 Oct 2023 15:17:39 -0400 Subject: cmCTestMultiProcessHandler: Clarify search for tests <= spare load Move code into conditions where it is needed and comment its purpose. --- Source/CTest/cmCTestMultiProcessHandler.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index e6466ad..02f1d83 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -558,25 +558,26 @@ void cmCTestMultiProcessHandler::StartNextTests() } size_t processors = this->GetProcessorsUsed(test); - bool testLoadOk = true; if (this->TestLoad > 0) { + // Exclude tests that are too big to fit in the spare load. if (processors <= spareLoad) { + // We found a test that fits in the spare load. cmCTestLog(this->CTest, DEBUG, "OK to run " << this->GetName(test) << ", it requires " << processors << " procs & system load is: " << systemLoad << std::endl); allTestsFailedTestLoadCheck = false; } else { - testLoadOk = false; + // Keep track of the smallest excluded test to report in message below. + if (processors <= minProcessorsRequired) { + minProcessorsRequired = processors; + testWithMinProcessors = this->GetName(test); + } + continue; } } - if (processors <= minProcessorsRequired) { - minProcessorsRequired = processors; - testWithMinProcessors = this->GetName(test); - } - - if (testLoadOk && processors <= numToStart && this->StartTest(test)) { + if (processors <= numToStart && this->StartTest(test)) { numToStart -= processors; } else if (numToStart == 0) { break; -- cgit v0.12