mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-28 09:58:53 -06:00
cmCTestMultiProcessHandler: Factor out duplicate test finish logic
This commit is contained in:
@@ -195,21 +195,7 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& j : this->Tests) {
|
this->FinishTestProcess(testRun, false);
|
||||||
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;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,33 +410,47 @@ bool cmCTestMultiProcessHandler::CheckOutput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (cmCTestRunTest* p : finished) {
|
for (cmCTestRunTest* p : finished) {
|
||||||
this->Completed++;
|
this->FinishTestProcess(p, true);
|
||||||
int test = p->GetIndex();
|
|
||||||
|
|
||||||
bool testResult = p->EndTest(this->Completed, this->Total, true);
|
|
||||||
if (p->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);
|
|
||||||
}
|
|
||||||
this->TestFinishMap[test] = true;
|
|
||||||
this->TestRunningMap[test] = false;
|
|
||||||
this->RunningTests.erase(p);
|
|
||||||
this->WriteCheckpoint(test);
|
|
||||||
this->UnlockResources(test);
|
|
||||||
this->RunningCount -= GetProcessorsUsed(test);
|
|
||||||
delete p;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmCTestMultiProcessHandler::FinishTestProcess(cmCTestRunTest* runner,
|
||||||
|
bool started)
|
||||||
|
{
|
||||||
|
this->Completed++;
|
||||||
|
|
||||||
|
int test = runner->GetIndex();
|
||||||
|
auto properties = runner->GetTestProperties();
|
||||||
|
|
||||||
|
bool testResult = runner->EndTest(this->Completed, this->Total, started);
|
||||||
|
if (started) {
|
||||||
|
if (runner->StartAgain()) {
|
||||||
|
this->Completed--; // remove the completed test because run again
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this->RunningTests.erase(runner);
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
void cmCTestMultiProcessHandler::UpdateCostData()
|
||||||
{
|
{
|
||||||
std::string fname = this->CTest->GetCostDataFile();
|
std::string fname = this->CTest->GetCostDataFile();
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ protected:
|
|||||||
// Return true if there are still tests running
|
// Return true if there are still tests running
|
||||||
// check all running processes for output and exit case
|
// check all running processes for output and exit case
|
||||||
bool CheckOutput();
|
bool CheckOutput();
|
||||||
|
void FinishTestProcess(cmCTestRunTest* runner, bool started);
|
||||||
|
|
||||||
void RemoveTest(int index);
|
void RemoveTest(int index);
|
||||||
// Check if we need to resume an interrupted test set
|
// Check if we need to resume an interrupted test set
|
||||||
void CheckResume();
|
void CheckResume();
|
||||||
|
|||||||
Reference in New Issue
Block a user