瀏覽代碼

Fixed overwriting of a previous change set

Zach Mullen 16 年之前
父節點
當前提交
a2ef34d344
共有 3 個文件被更改,包括 53 次插入2 次删除
  1. 52 0
      Source/CTest/cmCTestTestHandler.cxx
  2. 1 0
      Source/CTest/cmCTestTestHandler.h
  3. 0 2
      Source/cmCTest.cxx

+ 52 - 0
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<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" );
+    if ( this->LogFile )
+        {
+        *this->LogFile << "\nTime in " << *i << " = "
+                       << labelTimes[*i] << " sec"  << std::endl;
+        }
+    }
+}
+
 //----------------------------------------------------------------------
 void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
                                         std::vector<cmStdString> &passed,

+ 1 - 0
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
    */

+ 0 - 2
Source/cmCTest.cxx

@@ -1192,7 +1192,6 @@ int cmCTest::RunTest(std::vector<const char*> 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<const char*> 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"