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@ TriggerSite: @TRIGGER_SITE@
ScpCommand: @SCPCOMMAND@ ScpCommand: @SCPCOMMAND@
# Dashboard start time # Dashboard start time
NightlyStartTime: @NIGHTLY_START_TIME@ NightlyStartTime: @NIGHTLY_START_TIME@

View File

@ -16,6 +16,7 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include <stdlib.h> #include <stdlib.h>
#include <stack> #include <stack>
#include <float.h>
cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
{ {
@ -298,6 +299,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
std::string line; std::string line;
while(std::getline(fin, line)) while(std::getline(fin, line))
{ {
if(line == "---") break;
std::vector<cmsys::String> parts = std::vector<cmsys::String> parts =
cmSystemTools::SplitString(line.c_str(), ' '); cmSystemTools::SplitString(line.c_str(), ' ');
//Format: <name> <previous_runs> <avg_cost> //Format: <name> <previous_runs> <avg_cost>
@ -331,6 +333,14 @@ void cmCTestMultiProcessHandler::UpdateCostData()
fout << i->second->Name << " " << i->second->PreviousRuns << " " fout << i->second->Name << " " << i->second->PreviousRuns << " "
<< i->second->Cost << "\n"; << 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(); fout.close();
cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str()); cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str());
} }
@ -347,11 +357,13 @@ void cmCTestMultiProcessHandler::ReadCostData()
std::string line; std::string line;
while(std::getline(fin, line)) while(std::getline(fin, line))
{ {
if(line == "---") break;
std::vector<cmsys::String> parts = std::vector<cmsys::String> parts =
cmSystemTools::SplitString(line.c_str(), ' '); cmSystemTools::SplitString(line.c_str(), ' ');
// Probably an older version of the file, will be fixed next run // 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]; std::string name = parts[0];
int prev = atoi(parts[1].c_str()); int prev = atoi(parts[1].c_str());
@ -366,6 +378,14 @@ void cmCTestMultiProcessHandler::ReadCostData()
this->Properties[index]->Cost = cost; 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(); fin.close();
} }
} }
@ -392,7 +412,16 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
for(TestMap::iterator i = this->Tests.begin(); for(TestMap::iterator i = this->Tests.begin();
i != this->Tests.end(); ++i) 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() cmCTestTestHandler * GetTestHandler()
{ return this->TestHandler; } { return this->TestHandler; }
protected: protected:
cmCTest* CTest;
// Start the next test or tests as many as are allowed by // Start the next test or tests as many as are allowed by
// ParallelLevel // ParallelLevel
void StartNextTests(); void StartNextTests();
@ -99,10 +98,12 @@ protected:
std::map<int, cmStdString> TestOutput; std::map<int, cmStdString> TestOutput;
std::vector<cmStdString>* Passed; std::vector<cmStdString>* Passed;
std::vector<cmStdString>* Failed; std::vector<cmStdString>* Failed;
std::vector<std::string> LastTestsFailed;
std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults; std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
size_t ParallelLevel; // max number of process that can be run at once size_t ParallelLevel; // max number of process that can be run at once
std::set<cmCTestRunTest*> RunningTests; // current running tests std::set<cmCTestRunTest*> RunningTests; // current running tests
cmCTestTestHandler * TestHandler; cmCTestTestHandler * TestHandler;
cmCTest* CTest;
}; };
#endif #endif