diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2ff8e30b2..62b111f41 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -657,6 +657,58 @@ int cmCTestTestHandler::ProcessHandler() return 0; } +//---------------------------------------------------------------------- +void cmCTestTestHandler::PrintLabelSummary() +{ + cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); + cmCTestTestHandler::TestResultsVector::iterator ri = + this->TestResults.begin(); + std::map labelTimes; + std::set labels; + // initialize maps + for(; it != this->TestList.end(); ++it) + { + cmCTestTestProperties& p = *it; + if(p.Labels.size() != 0) + { + for(std::vector::iterator l = p.Labels.begin(); + l != p.Labels.end(); ++l) + { + labels.insert(*l); + labelTimes[*l] = 0; + } + } + } + it = this->TestList.begin(); + ri = this->TestResults.begin(); + // fill maps + for(; it != this->TestList.end(); ++it, ++ri) + { + cmCTestTestProperties& p = *it; + cmCTestTestResult &result = *ri; + if(p.Labels.size() != 0) + { + for(std::vector::iterator l = p.Labels.begin(); + l != p.Labels.end(); ++l) + { + labelTimes[*l] += result.ExecutionTime; + } + } + } + // now print times + for(std::set::const_iterator i = labels.begin(); + i != labels.end(); ++i) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTime in " + << *i << " = " << labelTimes[*i] << " sec" ); + if ( this->LogFile ) + { + *this->LogFile << "\nTime in " << *i << " = " + << labelTimes[*i] << " sec" << std::endl; + } + } +} + //---------------------------------------------------------------------- void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, std::vector &passed, diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index fe16e820d..03ce285ca 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -186,6 +186,7 @@ private: */ virtual void GenerateDartOutput(std::ostream& os); + void PrintLabelSummary(); /** * Run the tests for a directory and any subdirectories */ diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 0b74107ea..abf47a21c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1192,7 +1192,6 @@ int cmCTest::RunTest(std::vector argv, { if ( output ) { - //ZACH: need to grab the output here tempOutput.insert(tempOutput.end(), data, data+length); } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, cmCTestLogWrite(data, length)); @@ -1205,7 +1204,6 @@ int cmCTest::RunTest(std::vector argv, cmsysProcess_WaitForExit(cp, 0); if(output && tempOutput.begin() != tempOutput.end()) { - //We are waiting for exit before finally appending to the output output->append(&*tempOutput.begin(), tempOutput.size()); } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "-- Process completed"