[Cmake-commits] [cmake-commits] zach.mullen committed cmCTestMultiProcessHandler.cxx 1.17 1.18 cmCTestMultiProcessHandler.h 1.10 1.11 cmCTestTestHandler.cxx 1.116 1.117 cmCTestTestHandler.h 1.47 1.48
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Sep 8 13:39:15 EDT 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv30274/CTest
Modified Files:
cmCTestMultiProcessHandler.cxx cmCTestMultiProcessHandler.h
cmCTestTestHandler.cxx cmCTestTestHandler.h
Log Message:
ENH: Replaced the EXPENSIVE test property with a COST test property taking a floating point value. Tests are now started in descending order of their cost, which defaults to 0 if none is specified.
Index: cmCTestMultiProcessHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -C 2 -d -r1.17 -r1.18
*** cmCTestMultiProcessHandler.cxx 7 Sep 2009 14:26:08 -0000 1.17
--- cmCTestMultiProcessHandler.cxx 8 Sep 2009 17:39:12 -0000 1.18
***************
*** 31,37 ****
void
cmCTestMultiProcessHandler::SetTests(TestMap& tests,
! TestMap& expensiveTests,
PropertiesMap& properties)
{
// set test run map to false for all
for(TestMap::iterator i = this->Tests.begin();
--- 31,41 ----
void
cmCTestMultiProcessHandler::SetTests(TestMap& tests,
! TestCostMap& testCosts,
PropertiesMap& properties)
{
+ this->Tests = tests;
+ this->TestCosts = testCosts;
+ this->Properties = properties;
+ this->Total = this->Tests.size();
// set test run map to false for all
for(TestMap::iterator i = this->Tests.begin();
***************
*** 40,53 ****
this->TestRunningMap[i->first] = false;
this->TestFinishMap[i->first] = false;
-
- if(this->Properties[i->first]->Expensive)
- {
- this->ExpensiveTests[i->first] = i->second;
- }
}
- this->Tests = tests;
- this->ExpensiveTests = expensiveTests;
- this->Properties = properties;
- this->Total = this->Tests.size();
}
--- 44,48 ----
***************
*** 58,61 ****
--- 53,57 ----
}
+ //---------------------------------------------------------
void cmCTestMultiProcessHandler::RunTests()
{
***************
*** 68,72 ****
this->TestHandler->SetMaxIndex(this->FindMaxIndex());
this->StartNextTests();
! while(this->Tests.size() != 0 || this->ExpensiveTests.size() != 0)
{
this->CheckOutput();
--- 64,68 ----
this->TestHandler->SetMaxIndex(this->FindMaxIndex());
this->StartNextTests();
! while(this->Tests.size() != 0)
{
this->CheckOutput();
***************
*** 80,83 ****
--- 76,80 ----
}
+ //---------------------------------------------------------
void cmCTestMultiProcessHandler::SubmitBatchTests()
{
***************
*** 91,105 ****
}
void cmCTestMultiProcessHandler::StartTestProcess(int test)
{
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, test << ": "
! << " test " << test << "\n");
this->TestRunningMap[test] = true; // mark the test as running
// now remove the test itself
! if(this->ExpensiveTests.size() > 0)
! {
! this->ExpensiveTests.erase(test);
! }
! this->Tests.erase(test);
cmCTestRunTest* testRun = new cmCTestRunTest;
testRun->SetCTest(this->CTest);
--- 88,99 ----
}
+ //---------------------------------------------------------
void cmCTestMultiProcessHandler::StartTestProcess(int test)
{
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " test " << test << "\n");
this->TestRunningMap[test] = true; // mark the test as running
// now remove the test itself
! this->EraseTest(test);
!
cmCTestRunTest* testRun = new cmCTestRunTest;
testRun->SetCTest(this->CTest);
***************
*** 119,122 ****
--- 113,132 ----
}
+ //---------------------------------------------------------
+ void cmCTestMultiProcessHandler::EraseTest(int test)
+ {
+ this->Tests.erase(test);
+ for(TestCostMap::iterator i = this->TestCosts.begin();
+ i != this->TestCosts.end(); ++i)
+ {
+ if(i->second.find(test) != i->second.end())
+ {
+ i->second.erase(test);
+ return;
+ }
+ }
+ }
+
+ //---------------------------------------------------------
inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test)
{
***************
*** 131,138 ****
processors = this->ParallelLevel;
}
-
return processors;
}
bool cmCTestMultiProcessHandler::StartTest(int test)
{
--- 141,148 ----
processors = this->ParallelLevel;
}
return processors;
}
+ //---------------------------------------------------------
bool cmCTestMultiProcessHandler::StartTest(int test)
{
***************
*** 177,180 ****
--- 187,191 ----
}
+ //---------------------------------------------------------
void cmCTestMultiProcessHandler::StartNextTests()
{
***************
*** 184,217 ****
return;
}
- TestMap tests = this->ExpensiveTests.size() > 0 ?
- this->ExpensiveTests : this->Tests;
! for(TestMap::iterator i = tests.begin();
! i != tests.end(); ++i)
{
! size_t processors = GetProcessorsUsed(i->first);
! if(processors > numToStart)
! {
! return;
! }
! // start test should start only one test
! if(this->StartTest(i->first))
! {
! numToStart -= processors;
! this->RunningCount += processors;
! }
! else
! {
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
! << "Test did not start waiting on depends to finish: "
! << i->first << "\n");
! }
! if(numToStart == 0 )
{
! return;
}
}
}
bool cmCTestMultiProcessHandler::CheckOutput()
{
--- 195,231 ----
return;
}
! for(TestCostMap::reverse_iterator i = this->TestCosts.rbegin();
! i != this->TestCosts.rend(); ++i)
{
! TestSet tests = i->second; //copy the test set
! for(TestSet::iterator test = tests.begin();
! test != tests.end(); ++test)
{
! size_t processors = GetProcessorsUsed(*test);
! if(processors > numToStart)
! {
! return;
! }
! if(this->StartTest(*test))
! {
! numToStart -= processors;
! this->RunningCount += processors;
! }
! else
! {
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
! << "Test did not start waiting on depends to finish: "
! << *test << "\n");
! }
! if(numToStart == 0)
! {
! return;
! }
}
}
}
+ //---------------------------------------------------------
bool cmCTestMultiProcessHandler::CheckOutput()
{
***************
*** 249,257 ****
this->Failed->push_back(p->GetTestProperties()->Name);
}
- for(TestMap::iterator j = this->ExpensiveTests.begin();
- j != this->ExpensiveTests.end(); ++j)
- {
- j->second.erase(test);
- }
for(TestMap::iterator j = this->Tests.begin();
j != this->Tests.end(); ++j)
--- 263,266 ----
***************
*** 269,272 ****
--- 278,282 ----
}
+ //---------------------------------------------------------
void cmCTestMultiProcessHandler::WriteCheckpoint(int index)
{
***************
*** 355,363 ****
}
void cmCTestMultiProcessHandler::RemoveTest(int index)
{
! this->Tests.erase(index);
this->Properties.erase(index);
- this->ExpensiveTests.erase(index);
this->TestRunningMap[index] = false;
this->TestFinishMap[index] = true;
--- 365,373 ----
}
+ //---------------------------------------------------------
void cmCTestMultiProcessHandler::RemoveTest(int index)
{
! this->EraseTest(index);
this->Properties.erase(index);
this->TestRunningMap[index] = false;
this->TestFinishMap[index] = true;
***************
*** 365,368 ****
--- 375,379 ----
}
+ //---------------------------------------------------------
int cmCTestMultiProcessHandler::FindMaxIndex()
{
Index: cmCTestMultiProcessHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** cmCTestMultiProcessHandler.h 7 Sep 2009 14:26:09 -0000 1.10
--- cmCTestMultiProcessHandler.h 8 Sep 2009 17:39:13 -0000 1.11
***************
*** 32,35 ****
--- 32,36 ----
struct TestSet : public std::set<int> {};
struct TestMap : public std::map<int, TestSet> {};
+ struct TestCostMap : public std::map<float, TestSet> {};
struct PropertiesMap : public
std::map<int, cmCTestTestHandler::cmCTestTestProperties*> {};
***************
*** 37,41 ****
cmCTestMultiProcessHandler();
// Set the tests
! void SetTests(TestMap& tests, TestMap& expensiveTests,
PropertiesMap& properties);
// Set the max number of tests that can be run at the same time.
--- 38,42 ----
cmCTestMultiProcessHandler();
// Set the tests
! void SetTests(TestMap& tests, TestCostMap& testCosts,
PropertiesMap& properties);
// Set the max number of tests that can be run at the same time.
***************
*** 52,58 ****
}
void SetTestResults(std::vector<cmCTestTestHandler::cmCTestTestResult>* r)
! {
! this->TestResults = r;
! }
void SetCTest(cmCTest* ctest) { this->CTest = ctest;}
--- 53,57 ----
}
void SetTestResults(std::vector<cmCTestTestHandler::cmCTestTestResult>* r)
! { this->TestResults = r; }
void SetCTest(cmCTest* ctest) { this->CTest = ctest;}
***************
*** 74,77 ****
--- 73,77 ----
// Removes the checkpoint file
void MarkFinished();
+ void EraseTest(int index);
// Return true if there are still tests running
// check all running processes for output and exit case
***************
*** 84,88 ****
// map from test number to set of depend tests
TestMap Tests;
! TestMap ExpensiveTests;
//Total number of tests we'll be running
size_t Total;
--- 84,88 ----
// map from test number to set of depend tests
TestMap Tests;
! TestCostMap TestCosts;
//Total number of tests we'll be running
size_t Total;
Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.116
retrieving revision 1.117
diff -C 2 -d -r1.116 -r1.117
*** cmCTestTestHandler.cxx 7 Sep 2009 14:26:13 -0000 1.116
--- cmCTestTestHandler.cxx 8 Sep 2009 17:39:13 -0000 1.117
***************
*** 1011,1015 ****
cmCTestMultiProcessHandler::TestMap tests;
! cmCTestMultiProcessHandler::TestMap expensiveTests;
cmCTestMultiProcessHandler::PropertiesMap properties;
--- 1011,1015 ----
cmCTestMultiProcessHandler::TestMap tests;
! cmCTestMultiProcessHandler::TestCostMap testCosts;
cmCTestMultiProcessHandler::PropertiesMap properties;
***************
*** 1038,1047 ****
tests[it->Index] = depends;
properties[it->Index] = &*it;
! if(it->Expensive)
! {
! expensiveTests[it->Index] = depends;
! }
}
! parallel.SetTests(tests, expensiveTests, properties);
parallel.SetPassFailVectors(&passed, &failed);
this->TestResults.clear();
--- 1038,1044 ----
tests[it->Index] = depends;
properties[it->Index] = &*it;
! testCosts[p.Cost].insert(p.Index);
}
! parallel.SetTests(tests, testCosts, properties);
parallel.SetPassFailVectors(&passed, &failed);
this->TestResults.clear();
***************
*** 1976,1982 ****
rtit->Timeout = atof(val.c_str());
}
! if ( key == "EXPENSIVE" )
{
! rtit->Expensive = cmSystemTools::IsOn(val.c_str());
}
if ( key == "RUN_SERIAL" )
--- 1973,1979 ----
rtit->Timeout = atof(val.c_str());
}
! if ( key == "COST" )
{
! rtit->Cost = atof(val.c_str());
}
if ( key == "RUN_SERIAL" )
***************
*** 2131,2137 ****
test.IsInBasedOnREOptions = true;
test.WillFail = false;
- test.Expensive = false;
test.RunSerial = false;
test.Timeout = 0;
test.Processors = 1;
if (this->UseIncludeRegExpFlag &&
--- 2128,2134 ----
test.IsInBasedOnREOptions = true;
test.WillFail = false;
test.RunSerial = false;
test.Timeout = 0;
+ test.Cost = 0;
test.Processors = 1;
if (this->UseIncludeRegExpFlag &&
Index: cmCTestTestHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -C 2 -d -r1.47 -r1.48
*** cmCTestTestHandler.h 7 Sep 2009 14:26:16 -0000 1.47
--- cmCTestTestHandler.h 8 Sep 2009 17:39:13 -0000 1.48
***************
*** 97,101 ****
bool IsInBasedOnREOptions;
bool WillFail;
! bool Expensive;
bool RunSerial;
double Timeout;
--- 97,101 ----
bool IsInBasedOnREOptions;
bool WillFail;
! float Cost;
bool RunSerial;
double Timeout;
More information about the Cmake-commits
mailing list