Added the test property EXPENSIVE, which denotes that the given test(s) should be started prior to tests that are not marked as such. Also fixed test dependencies, and a few uninitialized variables in cmProcess.

This commit is contained in:
Zach Mullen 2009-09-04 10:16:06 -04:00
parent 85463b9955
commit c6e5dd21fd
4 changed files with 43 additions and 15 deletions

View File

@ -29,6 +29,7 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
// Set the tests
void
cmCTestMultiProcessHandler::SetTests(TestMap& tests,
TestMap& expensiveTests,
PropertiesMap& properties)
{
// set test run map to false for all
@ -37,10 +38,16 @@ cmCTestMultiProcessHandler::SetTests(TestMap& tests,
{
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->Total = this->Tests.size();
this->ExpensiveTests = expensiveTests;
this->Properties = properties;
this->Total = this->Tests.size();
}
// Set the max number of tests that can be run at the same time.
@ -59,7 +66,7 @@ void cmCTestMultiProcessHandler::RunTests()
this->CheckResume();
this->TestHandler->SetMaxIndex(this->FindMaxIndex());
this->StartNextTests();
while(this->Tests.size() != 0)
while(this->Tests.size() != 0 || this->ExpensiveTests.size() != 0)
{
this->CheckOutput();
this->StartNextTests();
@ -88,6 +95,10 @@ void cmCTestMultiProcessHandler::StartTestProcess(int 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);
@ -139,7 +150,6 @@ bool cmCTestMultiProcessHandler::StartTest(int test)
// if there are no depends left then run this test
if(totalDepends == 0)
{
// Start this test it has no depends
this->StartTestProcess(test);
return true;
}
@ -150,15 +160,14 @@ bool cmCTestMultiProcessHandler::StartTest(int test)
void cmCTestMultiProcessHandler::StartNextTests()
{
//cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
// << "Number of running tests : " << this->RunningTests.size()
// << "\n");
size_t numToStart = this->ParallelLevel - this->RunningTests.size();
if(numToStart == 0)
{
return;
}
TestMap tests = this->Tests;
TestMap tests = this->ExpensiveTests.size() > 0 ?
this->ExpensiveTests : this->Tests;
for(TestMap::iterator i = tests.begin();
i != tests.end(); ++i)
{
@ -218,6 +227,11 @@ bool cmCTestMultiProcessHandler::CheckOutput()
{
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)
{
@ -323,6 +337,7 @@ 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;
this->Completed++;

View File

@ -36,7 +36,8 @@ public:
cmCTestMultiProcessHandler();
// Set the tests
void SetTests(TestMap& tests, PropertiesMap& properties);
void SetTests(TestMap& tests, TestMap& expensiveTests,
PropertiesMap& properties);
// Set the max number of tests that can be run at the same time.
void SetParallelLevel(size_t);
void RunTests();
@ -81,6 +82,7 @@ protected:
int FindMaxIndex();
// map from test number to set of depend tests
TestMap Tests;
TestMap ExpensiveTests;
//Total number of tests we'll be running
size_t Total;
//Number of tests that are complete

View File

@ -1009,13 +1009,15 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
<< "----------------------------------------------------------"
<< std::endl;
cmCTestMultiProcessHandler::TestSet depends;
cmCTestMultiProcessHandler::TestMap tests;
cmCTestMultiProcessHandler::TestMap expensiveTests;
cmCTestMultiProcessHandler::PropertiesMap properties;
for (ListOfTests::iterator it = this->TestList.begin();
it != this->TestList.end(); it ++ )
{
cmCTestTestProperties& p = *it;
cmCTestMultiProcessHandler::TestSet depends;
if(p.Depends.size())
{
@ -1035,8 +1037,12 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
}
tests[it->Index] = depends;
properties[it->Index] = &*it;
if(it->Expensive)
{
expensiveTests[it->Index] = depends;
}
parallel.SetTests(tests, properties);
}
parallel.SetTests(tests, expensiveTests, properties);
parallel.SetPassFailVectors(&passed, &failed);
this->TestResults.clear();
parallel.SetTestResults(&this->TestResults);

View File

@ -22,6 +22,11 @@ cmProcess::cmProcess()
{
this->Process = 0;
this->Timeout = 0;
this->TotalTime = 0;
this->LastOutputPipe = cmsysProcess_Pipe_None;
this->ExitValue = 0;
this->Id = 0;
this->StartTime = 0;
}
cmProcess::~cmProcess()