diff options
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 37 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.h | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmProcess.cxx | 5 |
4 files changed, 43 insertions, 15 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 9fc4c079fa..07af80459b 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -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,11 +227,16 @@ 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) - { - j->second.erase(test); - } + j != this->Tests.end(); ++j) + { + j->second.erase(test); + } this->TestFinishMap[test] = true; this->TestRunningMap[test] = false; this->RunningTests.erase(p); @@ -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++; diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index a7800fcb6e..9c63be7c96 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -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 diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 34b4192ed4..d57bfa52a8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1009,14 +1009,16 @@ 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()) { for(std::vector<std::string>::iterator i = p.Depends.begin(); @@ -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); diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index b0914f250f..2d98ad557f 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -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() |