diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-09-11 17:34:35 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-09-11 17:34:35 (GMT) |
commit | 8a690289c205da90133e704439dc6f7ef1a08680 (patch) | |
tree | ec95de31ddfdba630a075688b59184de1fa1ea61 /Source/CTest | |
parent | 6a7eae718457e8ad9a91729f4c02a666e6ceba98 (diff) | |
download | CMake-8a690289c205da90133e704439dc6f7ef1a08680.zip CMake-8a690289c205da90133e704439dc6f7ef1a08680.tar.gz CMake-8a690289c205da90133e704439dc6f7ef1a08680.tar.bz2 |
Add label summary times to ctest default output. Also, remove parallel time output. Add flag to disable label summary.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index c6af20d..6e718da 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -589,25 +589,15 @@ int cmCTestTestHandler::ProcessHandler() << static_cast<int>(percent + .5) << "% tests passed, " << failed.size() << " tests failed out of " << total << std::endl); - double totalTestTime = 0; - - for(cmCTestTestHandler::TestResultsVector::size_type cc = 0; - cc < this->TestResults.size(); cc ++ ) + if(this->CTest->GetLabelSummary()) { - cmCTestTestResult *result = &this->TestResults[cc]; - totalTestTime += result->ExecutionTime; + this->PrintLabelSummary(); } - char realBuf[1024]; sprintf(realBuf, "%6.2f sec", (double)(clock_finish - clock_start)); cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " << realBuf << "\n" ); - char totalBuf[1024]; - sprintf(totalBuf, "%6.2f sec", totalTestTime); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (parallel) = " - << totalBuf << "\n" ); - if (failed.size()) { cmGeneratedFileStream ofs; @@ -672,6 +662,7 @@ void cmCTestTestHandler::PrintLabelSummary() std::map<cmStdString, double> labelTimes; std::set<cmStdString> labels; // initialize maps + std::string::size_type maxlen = 0; for(; it != this->TestList.end(); ++it) { cmCTestTestProperties& p = *it; @@ -680,6 +671,10 @@ void cmCTestTestHandler::PrintLabelSummary() for(std::vector<std::string>::iterator l = p.Labels.begin(); l != p.Labels.end(); ++l) { + if((*l).size() > maxlen) + { + maxlen = (*l).size(); + } labels.insert(*l); labelTimes[*l] = 0; } @@ -696,23 +691,40 @@ void cmCTestTestHandler::PrintLabelSummary() { for(std::vector<std::string>::iterator l = p.Labels.begin(); l != p.Labels.end(); ++l) - { + { labelTimes[*l] += result.ExecutionTime; } } } - // now print times + // now print times + if(labels.size()) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); + } for(std::set<cmStdString>::const_iterator i = labels.begin(); i != labels.end(); ++i) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTime in " - << *i << " = " << labelTimes[*i] << " sec" ); + std::string label = *i; + label.resize(maxlen +3, ' '); + char buf[1024]; + sprintf(buf, "%6.2f sec", labelTimes[*i]); + cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n" + << label << " = " << buf ); if ( this->LogFile ) - { - *this->LogFile << "\nTime in " << *i << " = " - << labelTimes[*i] << " sec" << std::endl; - } + { + *this->LogFile << "\n" << *i << " = " + << buf << "\n"; + } + } + if(labels.size()) + { + if(this->LogFile) + { + *this->LogFile << "\n"; + } + cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n"); } + } //---------------------------------------------------------------------- |