[cmake-commits] hoffman committed cmCTestMemCheckHandler.cxx 1.14 1.15

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Jul 26 16:38:02 EDT 2007


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

Modified Files:
	cmCTestMemCheckHandler.cxx 
Log Message:
ENH: add test output to valgrind output and truncate output for valgrind


Index: cmCTestMemCheckHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMemCheckHandler.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cmCTestMemCheckHandler.cxx	24 Jul 2007 18:43:31 -0000	1.14
+++ cmCTestMemCheckHandler.cxx	26 Jul 2007 20:38:00 -0000	1.15
@@ -644,7 +644,13 @@
 {
   std::vector<cmStdString> lines;
   cmSystemTools::Split(str.c_str(), lines);
-
+  bool unlimitedOutput = false;
+  if(str.find("CTEST_FULL_OUTPUT") != str.npos ||
+    this->CustomMaximumFailedTestOutputSize == 0)
+    {
+    unlimitedOutput = true;
+    }
+  
   std::string::size_type cc;
 
   cmOStringStream ostr;
@@ -680,9 +686,11 @@
   cmsys::RegularExpression vgIPW("== .*Invalid write of size [0-9]");
   cmsys::RegularExpression vgABR("== .*pthread_mutex_unlock: mutex is "
     "locked by a different thread");
-
+  std::vector<std::string::size_type> nonValGrindOutput;
   double sttime = cmSystemTools::GetTime();
   cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl);
+  std::string::size_type totalOutputSize = 0;
+  bool outputFull = false;
   for ( cc = 0; cc < lines.size(); cc ++ )
     {
     if ( valgrindLine.find(lines[cc]) )
@@ -747,7 +755,38 @@
         results[failure] ++;
         defects ++;
         }
-      ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl;
+      if(!outputFull)
+        {
+        totalOutputSize += lines[cc].size();
+        ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl;
+        if(totalOutputSize > 
+           static_cast<size_t>(this->CustomMaximumFailedTestOutputSize))
+          {
+          outputFull = true;
+          }
+        }
+      } 
+    else
+      {
+      nonValGrindOutput.push_back(cc);
+      }
+    }
+  // Now put all all the non valgrind output into the test output
+  if(!outputFull)
+    {
+    for(std::vector<std::string::size_type>::iterator i = 
+          nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i)
+      {
+      totalOutputSize += lines[*i].size();
+      ostr << cmCTest::MakeXMLSafe(lines[*i]) << std::endl;
+      if(!unlimitedOutput && totalOutputSize > 
+         static_cast<size_t>(this->CustomMaximumFailedTestOutputSize))
+        {
+        outputFull = true;
+        ostr << "....\n";
+        ostr << "Output for this test has been truncated see testing machine logs for full output,\n";
+        ostr << "or put CTEST_FULL_OUTPUT in the output of this test program.\n";
+        }
       }
     }
   cmCTestLog(this->CTest, DEBUG, "End test (elapsed: "



More information about the Cmake-commits mailing list