diff options
author | Bryon Bean <bryon.bean@kitware.com> | 2017-10-23 12:16:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-01-10 15:19:13 (GMT) |
commit | 05da65bc22dee788576504cdd203e5fdd5f9d633 (patch) | |
tree | ad926f6b86d640d25e7fb76df24fae6765460a39 /Source/CTest/cmCTestMultiProcessHandler.cxx | |
parent | dd945345715b90b2a1db769865c79d86a1dfad06 (diff) | |
download | CMake-05da65bc22dee788576504cdd203e5fdd5f9d633.zip CMake-05da65bc22dee788576504cdd203e5fdd5f9d633.tar.gz CMake-05da65bc22dee788576504cdd203e5fdd5f9d633.tar.bz2 |
cmCTestMultiProcessHandler: Factor out duplicate test finish logic
Diffstat (limited to 'Source/CTest/cmCTestMultiProcessHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 4a980d7..453d5cb 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -195,21 +195,7 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) return true; } - 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->FinishTestProcess(testRun, false); return false; } @@ -424,31 +410,45 @@ bool cmCTestMultiProcessHandler::CheckOutput() } } for (cmCTestRunTest* p : finished) { - this->Completed++; - int test = p->GetIndex(); + this->FinishTestProcess(p, true); + } + return true; +} + +void cmCTestMultiProcessHandler::FinishTestProcess(cmCTestRunTest* runner, + bool started) +{ + this->Completed++; + + int test = runner->GetIndex(); + auto properties = runner->GetTestProperties(); - bool testResult = p->EndTest(this->Completed, this->Total, true); - if (p->StartAgain()) { + bool testResult = runner->EndTest(this->Completed, this->Total, started); + if (started) { + if (runner->StartAgain()) { this->Completed--; // remove the completed test because run again - continue; - } - if (testResult) { - this->Passed->push_back(p->GetTestProperties()->Name); - } else { - this->Failed->push_back(p->GetTestProperties()->Name); - } - for (auto& t : this->Tests) { - t.second.erase(test); + return; } - this->TestFinishMap[test] = true; - this->TestRunningMap[test] = false; - this->RunningTests.erase(p); - this->WriteCheckpoint(test); - this->UnlockResources(test); - this->RunningCount -= GetProcessorsUsed(test); - delete p; + this->RunningTests.erase(runner); } - return true; + + if (testResult) { + this->Passed->push_back(properties->Name); + } else if (!properties->Disabled) { + this->Failed->push_back(properties->Name); + } + + for (auto& t : this->Tests) { + t.second.erase(test); + } + + this->TestFinishMap[test] = true; + this->TestRunningMap[test] = false; + this->WriteCheckpoint(test); + this->UnlockResources(test); + this->RunningCount -= GetProcessorsUsed(test); + + delete runner; } void cmCTestMultiProcessHandler::UpdateCostData() |