summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-08-18 17:34:05 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2009-08-18 17:34:05 (GMT)
commit3c34d0440c8c83124d991850535e69af6ccc684e (patch)
tree09c669330025d49b2bd1d3ad7132f470316ebb6f /Source
parent154a35c7bc9c11348ac20d35d9f7852f5f354b27 (diff)
downloadCMake-3c34d0440c8c83124d991850535e69af6ccc684e.zip
CMake-3c34d0440c8c83124d991850535e69af6ccc684e.tar.gz
CMake-3c34d0440c8c83124d991850535e69af6ccc684e.tar.bz2
If labels are found on the tests, then print a time summary for all the tests run with each label.
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx49
-rw-r--r--Source/CTest/cmCTestTestHandler.h1
2 files changed, 49 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 3407048..37de4f9 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -589,7 +589,7 @@ int cmCTestTestHandler::ProcessHandler()
cmCTestTestResult *result = &this->TestResults[cc];
totalTestTime += result->ExecutionTime;
}
-
+ this->PrintLabelSummary();
char buf[1024];
sprintf(buf, "%6.2f sec", totalTestTime);
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time = "
@@ -657,6 +657,53 @@ int cmCTestTestHandler::ProcessHandler()
}
//----------------------------------------------------------------------
+void cmCTestTestHandler::PrintLabelSummary()
+{
+ cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin();
+ cmCTestTestHandler::TestResultsVector::iterator ri =
+ this->TestResults.begin();
+ std::map<cmStdString, double> labelTimes;
+ std::set<cmStdString> labels;
+ // initialize maps
+ for(; it != this->TestList.end(); ++it)
+ {
+ cmCTestTestProperties& p = *it;
+ if(p.Labels.size() != 0)
+ {
+ for(std::vector<std::string>::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<std::string>::iterator l = p.Labels.begin();
+ l != p.Labels.end(); ++l)
+ {
+ labelTimes[*l] += result.ExecutionTime;
+ }
+ }
+ }
+ // now print times
+ for(std::set<cmStdString>::const_iterator i = labels.begin();
+ i != labels.end(); ++i)
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTime in "
+ << *i << " = " << labelTimes[*i] << " sec" );
+ }
+}
+
+//----------------------------------------------------------------------
void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
std::vector<cmStdString> &passed,
std::vector<cmStdString> &failed,
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index e5ee5dc..b0188e1 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -185,6 +185,7 @@ private:
*/
virtual void GenerateDartOutput(std::ostream& os);
+ void PrintLabelSummary();
/**
* Run the tests for a directory and any subdirectories
*/