diff options
author | Brad King <brad.king@kitware.com> | 2017-12-15 20:10:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-01-08 17:55:01 (GMT) |
commit | 7e0eb77f2f0da764ba9d8a4045351bd7799e101d (patch) | |
tree | c0e99dd84b5560d420a42756242e463e01f5c95a /Source | |
parent | 61ab5a8ef451484d3014118ed193eeba83bb22a4 (diff) | |
download | CMake-7e0eb77f2f0da764ba9d8a4045351bd7799e101d.zip CMake-7e0eb77f2f0da764ba9d8a4045351bd7799e101d.tar.gz CMake-7e0eb77f2f0da764ba9d8a4045351bd7799e101d.tar.bz2 |
cmCTestMultiProcessHandler: Fix StartNextTests loop on not-started test
If `StartTestProcess` does not start a test, propagate this information
back up to the `StartNextTests` loop so that it can move on to another
candidate without allocating processors to a test that didn't run.
Otherwise we have to wait for the next time `RunTests` loops around and
calls `StartNextTests` again.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 37 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.h | 2 |
2 files changed, 20 insertions, 19 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 6d71c45..6cdec8d 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -112,7 +112,7 @@ void cmCTestMultiProcessHandler::RunTests() this->UpdateCostData(); } -void cmCTestMultiProcessHandler::StartTestProcess(int test) +bool cmCTestMultiProcessHandler::StartTestProcess(int test) { std::chrono::system_clock::time_point stop_time = this->CTest->GetStopTime(); if (stop_time != std::chrono::system_clock::time_point() && @@ -121,7 +121,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) "Stopping all tests." << std::endl); this->StopTimePassed = true; - return; + return false; } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, @@ -155,23 +155,25 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) if (testRun->StartTest(this->Total)) { this->RunningTests.insert(testRun); - } else { + return true; + } - for (auto& j : this->Tests) { - j.second.erase(test); - } + for (auto& j : this->Tests) { + j.second.erase(test); + } - this->UnlockResources(test); - this->Completed++; - this->TestFinishMap[test] = true; - this->TestRunningMap[test] = false; - this->RunningCount -= GetProcessorsUsed(test); - testRun->EndTest(this->Completed, this->Total, false); - if (!this->Properties[test]->Disabled) { - this->Failed->push_back(this->Properties[test]->Name); - } - delete testRun; + this->UnlockResources(test); + this->Completed++; + this->TestFinishMap[test] = true; + this->TestRunningMap[test] = false; + this->RunningCount -= GetProcessorsUsed(test); + testRun->EndTest(this->Completed, this->Total, false); + if (!this->Properties[test]->Disabled) { + this->Failed->push_back(this->Properties[test]->Name); } + delete testRun; + + return false; } void cmCTestMultiProcessHandler::LockResources(int index) @@ -229,8 +231,7 @@ bool cmCTestMultiProcessHandler::StartTest(int test) // if there are no depends left then run this test if (this->Tests[test].empty()) { - this->StartTestProcess(test); - return true; + return this->StartTestProcess(test); } // This test was not able to start because it is waiting // on depends to run diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index dccc2c8..77a0ed9 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -75,7 +75,7 @@ protected: // Start the next test or tests as many as are allowed by // ParallelLevel void StartNextTests(); - void StartTestProcess(int test); + bool StartTestProcess(int test); bool StartTest(int test); // Mark the checkpoint for the given test void WriteCheckpoint(int index); |