[Cmake-commits] [cmake-commits] hoffman committed cmCTestTestHandler.cxx 1.101 1.102 cmCTestTestHandler.h 1.36 1.37

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Aug 18 13:34:07 EDT 2009


Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv6194

Modified Files:
	cmCTestTestHandler.cxx cmCTestTestHandler.h 
Log Message:
If labels are found on the tests, then print a time summary for all the tests run with each label.


Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.101
retrieving revision 1.102
diff -C 2 -d -r1.101 -r1.102
*** cmCTestTestHandler.cxx	12 Aug 2009 02:02:49 -0000	1.101
--- cmCTestTestHandler.cxx	18 Aug 2009 17:34:04 -0000	1.102
***************
*** 590,594 ****
          totalTestTime += result->ExecutionTime;
          }
!       
        char buf[1024];
        sprintf(buf, "%6.2f sec", totalTestTime); 
--- 590,594 ----
          totalTestTime += result->ExecutionTime;
          }
!       this->PrintLabelSummary();
        char buf[1024];
        sprintf(buf, "%6.2f sec", totalTestTime); 
***************
*** 658,661 ****
--- 658,708 ----
  
  //----------------------------------------------------------------------
+ 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,

Index: cmCTestTestHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -C 2 -d -r1.36 -r1.37
*** cmCTestTestHandler.h	24 Feb 2009 22:23:51 -0000	1.36
--- cmCTestTestHandler.h	18 Aug 2009 17:34:05 -0000	1.37
***************
*** 186,189 ****
--- 186,190 ----
    virtual void GenerateDartOutput(std::ostream& os);
  
+   void PrintLabelSummary();
    /**
     * Run the tests for a directory and any subdirectories



More information about the Cmake-commits mailing list