CTest: prioritize tests by their depth in the dependency graph
This commit is contained in:
parent
44017a4767
commit
e809d8cfdf
@ -441,11 +441,41 @@ int cmCTestMultiProcessHandler::SearchByName(std::string name)
|
|||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
void cmCTestMultiProcessHandler::CreateTestCostList()
|
void cmCTestMultiProcessHandler::CreateTestCostList()
|
||||||
{
|
{
|
||||||
|
std::list<TestSet> priorityStack;
|
||||||
|
priorityStack.push_back(TestSet());
|
||||||
|
TestSet &topLevel = priorityStack.back();
|
||||||
|
|
||||||
|
for(TestMap::const_iterator i = this->Tests.begin();
|
||||||
|
i != this->Tests.end(); ++i)
|
||||||
|
{
|
||||||
|
topLevel.insert(i->first);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(priorityStack.back().size())
|
||||||
|
{
|
||||||
|
TestSet &previousSet = priorityStack.back();
|
||||||
|
priorityStack.push_back(TestSet());
|
||||||
|
TestSet ¤tSet = priorityStack.back();
|
||||||
|
|
||||||
|
for(TestSet::iterator i = previousSet.begin();
|
||||||
|
i != previousSet.end(); ++i)
|
||||||
|
{
|
||||||
|
TestSet const& dependencies = this->Tests[*i];
|
||||||
|
currentSet.insert(dependencies.begin(), dependencies.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(TestSet::iterator i = currentSet.begin();
|
||||||
|
i != currentSet.end(); ++i)
|
||||||
|
{
|
||||||
|
previousSet.erase(*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
priorityStack.pop_back();
|
||||||
|
|
||||||
for(TestMap::iterator i = this->Tests.begin();
|
for(TestMap::iterator i = this->Tests.begin();
|
||||||
i != this->Tests.end(); ++i)
|
i != this->Tests.end(); ++i)
|
||||||
{
|
{
|
||||||
SortedTests.push_back(i->first);
|
|
||||||
|
|
||||||
//If the test failed last time, it should be run first, so max the cost.
|
//If the test failed last time, it should be run first, so max the cost.
|
||||||
//Only do this for parallel runs; in non-parallel runs, avoid clobbering
|
//Only do this for parallel runs; in non-parallel runs, avoid clobbering
|
||||||
//the test's explicitly set cost.
|
//the test's explicitly set cost.
|
||||||
@ -457,8 +487,19 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TestComparator comp(this);
|
for(std::list<TestSet>::reverse_iterator i = priorityStack.rbegin();
|
||||||
std::stable_sort(SortedTests.begin(), SortedTests.end(), comp);
|
i != priorityStack.rend(); ++i)
|
||||||
|
{
|
||||||
|
TestSet ¤tSet = *i;
|
||||||
|
TestComparator comp(this);
|
||||||
|
|
||||||
|
TestList sortedCopy;
|
||||||
|
sortedCopy.insert(sortedCopy.end(), currentSet.begin(), currentSet.end());
|
||||||
|
std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp);
|
||||||
|
|
||||||
|
this->SortedTests.insert(this->SortedTests.end(),
|
||||||
|
sortedCopy.begin(), sortedCopy.end());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user