If tests failed on the last run, have them run first next time

This commit is contained in:
Zach Mullen 2010-03-01 11:59:00 -05:00
parent 09e748c69a
commit 348f6c4d8c
3 changed files with 33 additions and 4 deletions

View File

@ -29,7 +29,6 @@ DropMethod: @DROP_METHOD@
TriggerSite: @TRIGGER_SITE@
ScpCommand: @SCPCOMMAND@
# Dashboard start time
NightlyStartTime: @NIGHTLY_START_TIME@

View File

@ -16,6 +16,7 @@
#include "cmSystemTools.h"
#include <stdlib.h>
#include <stack>
#include <float.h>
cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
{
@ -298,6 +299,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
std::string line;
while(std::getline(fin, line))
{
if(line == "---") break;
std::vector<cmsys::String> parts =
cmSystemTools::SplitString(line.c_str(), ' ');
//Format: <name> <previous_runs> <avg_cost>
@ -331,6 +333,14 @@ void cmCTestMultiProcessHandler::UpdateCostData()
fout << i->second->Name << " " << i->second->PreviousRuns << " "
<< i->second->Cost << "\n";
}
// Write list of failed tests
fout << "---\n";
for(std::vector<cmStdString>::iterator i = this->Failed->begin();
i != this->Failed->end(); ++i)
{
fout << i->c_str() << "\n";
}
fout.close();
cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str());
}
@ -347,11 +357,13 @@ void cmCTestMultiProcessHandler::ReadCostData()
std::string line;
while(std::getline(fin, line))
{
if(line == "---") break;
std::vector<cmsys::String> parts =
cmSystemTools::SplitString(line.c_str(), ' ');
// Probably an older version of the file, will be fixed next run
if(parts.size() < 3) break;
if(parts.size() < 3) return;
std::string name = parts[0];
int prev = atoi(parts[1].c_str());
@ -366,6 +378,14 @@ void cmCTestMultiProcessHandler::ReadCostData()
this->Properties[index]->Cost = cost;
}
}
// Next part of the file is the failed tests
while(std::getline(fin, line))
{
if(line != "")
{
this->LastTestsFailed.push_back(line);
}
}
fin.close();
}
}
@ -392,7 +412,16 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
for(TestMap::iterator i = this->Tests.begin();
i != this->Tests.end(); ++i)
{
this->TestCosts[this->Properties[i->first]->Cost].insert(i->first);
std::string name = this->Properties[i->first]->Name;
if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(),
name) != this->LastTestsFailed.end())
{
this->TestCosts[FLT_MAX].insert(i->first);
}
else
{
this->TestCosts[this->Properties[i->first]->Cost].insert(i->first);
}
}
}

View File

@ -56,7 +56,6 @@ public:
cmCTestTestHandler * GetTestHandler()
{ return this->TestHandler; }
protected:
cmCTest* CTest;
// Start the next test or tests as many as are allowed by
// ParallelLevel
void StartNextTests();
@ -99,10 +98,12 @@ protected:
std::map<int, cmStdString> TestOutput;
std::vector<cmStdString>* Passed;
std::vector<cmStdString>* Failed;
std::vector<std::string> LastTestsFailed;
std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
size_t ParallelLevel; // max number of process that can be run at once
std::set<cmCTestRunTest*> RunningTests; // current running tests
cmCTestTestHandler * TestHandler;
cmCTest* CTest;
};
#endif