summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2010-03-01 16:59:00 (GMT)
committerZach Mullen <zach.mullen@kitware.com>2010-03-01 16:59:00 (GMT)
commit348f6c4d8cd0945a61c070b5094bc89518cc27e0 (patch)
tree4afbd885f169c1f160545fdc7a1f808056d009fd /Source
parent09e748c69a31e54ad4ceb16229f4caa987d61d3b (diff)
downloadCMake-348f6c4d8cd0945a61c070b5094bc89518cc27e0.zip
CMake-348f6c4d8cd0945a61c070b5094bc89518cc27e0.tar.gz
CMake-348f6c4d8cd0945a61c070b5094bc89518cc27e0.tar.bz2
If tests failed on the last run, have them run first next time
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx33
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h3
2 files changed, 33 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 31aff8b..b29e4e3 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -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);
+ }
}
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 6136103..ebec6c7 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -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