[Cmake-commits] CMake branch, next, updated. v2.8.9-908-gd765262

Rolf Eike Beer eike at sf-mail.de
Sun Sep 30 15:10:16 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  d7652627ce6151597fa4d91d659723feb69b6138 (commit)
       via  7d87f8f4ab1b0db04f1e5e5ceca558b640e6ec57 (commit)
       via  7525d60e35cce3488358493bc520eb2cfe79e522 (commit)
      from  7ad210cae6c850b0f29cf7a21e677387fb60271f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d7652627ce6151597fa4d91d659723feb69b6138
commit d7652627ce6151597fa4d91d659723feb69b6138
Merge: 7ad210c 7d87f8f
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Sun Sep 30 15:10:13 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Sep 30 15:10:13 2012 -0400

    Merge topic 'test-ctest-memcheck' into next
    
    7d87f8f CTest: improve memory checker type detection
    7525d60 CTest: fix usage of memory checker with spaces in path


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d87f8f4ab1b0db04f1e5e5ceca558b640e6ec57
commit 7d87f8f4ab1b0db04f1e5e5ceca558b640e6ec57
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Sun Sep 30 20:53:27 2012 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Sun Sep 30 21:08:53 2012 +0200

    CTest: improve memory checker type detection
    
    If the checker was explicitely set with a "TypeCommand" variable (e.g.
    ValgrindCommand) then we now just believe that this is valgrind, even if
    nothing in the path matches "valgrind". Only when "MemoryCheckCommand" was used
    we still scan the path to find out what checker we have.

diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index f446c94..80218ad 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -412,24 +412,45 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
     {
     this->MemoryTester
       = this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str();
+
+    // determine the checker type
+    if ( this->MemoryTester.find("valgrind") != std::string::npos )
+      {
+        this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
+      }
+    else if ( this->MemoryTester.find("purify") != std::string::npos )
+      {
+      this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
+      }
+    else if ( this->MemoryTester.find("BC") != std::string::npos )
+      {
+      this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
+      }
+    else
+      {
+      this->MemoryTesterStyle = cmCTestMemCheckHandler::UNKNOWN;
+      }
     }
   else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
         "PurifyCommand").c_str()) )
     {
     this->MemoryTester
       = this->CTest->GetCTestConfiguration("PurifyCommand").c_str();
+    this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
     }
   else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
         "ValgrindCommand").c_str()) )
     {
     this->MemoryTester
       = this->CTest->GetCTestConfiguration("ValgrindCommand").c_str();
+    this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
     }
   else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
         "BoundsCheckerCommand").c_str()) )
     {
     this->MemoryTester
       = this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
+    this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
     }
   else
     {
@@ -467,82 +488,81 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
   this->MemoryTesterOutputFile
     = this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
 
-  if ( this->MemoryTester.find("valgrind") != std::string::npos )
+  switch ( this->MemoryTesterStyle )
     {
-    this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
-    if ( this->MemoryTesterOptions.empty() )
-      {
-      this->MemoryTesterOptions.push_back("-q");
-      this->MemoryTesterOptions.push_back("--tool=memcheck");
-      this->MemoryTesterOptions.push_back("--leak-check=yes");
-      this->MemoryTesterOptions.push_back("--show-reachable=yes");
-      this->MemoryTesterOptions.push_back("--workaround-gcc296-bugs=yes");
-      this->MemoryTesterOptions.push_back("--num-callers=50");
-      }
-    if ( this->CTest->GetCTestConfiguration(
-        "MemoryCheckSuppressionFile").size() )
-      {
-      if ( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
-            "MemoryCheckSuppressionFile").c_str()) )
+    case cmCTestMemCheckHandler::VALGRIND:
+      if ( this->MemoryTesterOptions.empty() )
         {
-        cmCTestLog(this->CTest, ERROR_MESSAGE,
-          "Cannot find memory checker suppression file: "
-          << this->CTest->GetCTestConfiguration(
-            "MemoryCheckSuppressionFile").c_str() << std::endl);
-        return false;
-        }
-      std::string suppressions = "--suppressions="
-        + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
-      this->MemoryTesterOptions.push_back(suppressions);
-      }
-    }
-  else if ( this->MemoryTester.find("purify") != std::string::npos )
-    {
-    this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
-    std::string outputFile;
-#ifdef _WIN32
-    if( this->CTest->GetCTestConfiguration(
+        this->MemoryTesterOptions.push_back("-q");
+        this->MemoryTesterOptions.push_back("--tool=memcheck");
+        this->MemoryTesterOptions.push_back("--leak-check=yes");
+        this->MemoryTesterOptions.push_back("--show-reachable=yes");
+        this->MemoryTesterOptions.push_back("--workaround-gcc296-bugs=yes");
+        this->MemoryTesterOptions.push_back("--num-callers=50");
+        }
+      if ( this->CTest->GetCTestConfiguration(
           "MemoryCheckSuppressionFile").size() )
+        {
+        if ( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
+              "MemoryCheckSuppressionFile").c_str()) )
+          {
+          cmCTestLog(this->CTest, ERROR_MESSAGE,
+            "Cannot find memory checker suppression file: "
+            << this->CTest->GetCTestConfiguration(
+              "MemoryCheckSuppressionFile").c_str() << std::endl);
+          return false;
+          }
+        std::string suppressions = "--suppressions="
+          + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
+        this->MemoryTesterOptions.push_back(suppressions);
+        }
+      break;
+    case cmCTestMemCheckHandler::PURIFY:
       {
-      if( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
-                                       "MemoryCheckSuppressionFile").c_str()) )
+      std::string outputFile;
+#ifdef _WIN32
+      if( this->CTest->GetCTestConfiguration(
+            "MemoryCheckSuppressionFile").size() )
         {
-        cmCTestLog(this->CTest, ERROR_MESSAGE,
-                   "Cannot find memory checker suppression file: "
-                   << this->CTest->GetCTestConfiguration(
-                     "MemoryCheckSuppressionFile").c_str() << std::endl);
-        return false;
-        }
-      std::string filterFiles = "/FilterFiles="
-        + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
-      this->MemoryTesterOptions.push_back(filterFiles);
-      }
-    outputFile = "/SAVETEXTDATA=";
+        if( !cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
+                                       "MemoryCheckSuppressionFile").c_str()) )
+          {
+          cmCTestLog(this->CTest, ERROR_MESSAGE,
+                     "Cannot find memory checker suppression file: "
+                     << this->CTest->GetCTestConfiguration(
+                       "MemoryCheckSuppressionFile").c_str() << std::endl);
+          return false;
+          }
+        std::string filterFiles = "/FilterFiles="
+          + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
+        this->MemoryTesterOptions.push_back(filterFiles);
+        }
+      outputFile = "/SAVETEXTDATA=";
 #else
-    outputFile = "-log-file=";
+      outputFile = "-log-file=";
 #endif
-    outputFile += this->MemoryTesterOutputFile;
-    this->MemoryTesterOptions.push_back(outputFile);
-    }
-  else if ( this->MemoryTester.find("BC") != std::string::npos )
-    {
-    this->BoundsCheckerXMLFile = this->MemoryTesterOutputFile;
-    std::string dpbdFile = this->CTest->GetBinaryDir()
-      + "/Testing/Temporary/MemoryChecker.DPbd";
-    this->BoundsCheckerDPBDFile = dpbdFile;
-    this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
-    this->MemoryTesterOptions.push_back("/B");
-    this->MemoryTesterOptions.push_back(dpbdFile);
-    this->MemoryTesterOptions.push_back("/X");
-    this->MemoryTesterOptions.push_back(this->MemoryTesterOutputFile);
-    this->MemoryTesterOptions.push_back("/M");
-    }
-  else
-    {
-    cmCTestLog(this->CTest, ERROR_MESSAGE,
-      "Do not understand memory checker: " << this->MemoryTester.c_str()
-      << std::endl);
-    return false;
+      outputFile += this->MemoryTesterOutputFile;
+      this->MemoryTesterOptions.push_back(outputFile);
+      break;
+      }
+    case cmCTestMemCheckHandler::BOUNDS_CHECKER:
+      {
+      this->BoundsCheckerXMLFile = this->MemoryTesterOutputFile;
+      std::string dpbdFile = this->CTest->GetBinaryDir()
+        + "/Testing/Temporary/MemoryChecker.DPbd";
+      this->BoundsCheckerDPBDFile = dpbdFile;
+      this->MemoryTesterOptions.push_back("/B");
+      this->MemoryTesterOptions.push_back(dpbdFile);
+      this->MemoryTesterOptions.push_back("/X");
+      this->MemoryTesterOptions.push_back(this->MemoryTesterOutputFile);
+      this->MemoryTesterOptions.push_back("/M");
+      break;
+      }
+    default:
+      cmCTestLog(this->CTest, ERROR_MESSAGE,
+        "Do not understand memory checker: " << this->MemoryTester.c_str()
+        << std::endl);
+      return false;
     }
 
   std::vector<cmStdString>::size_type cc;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7525d60e35cce3488358493bc520eb2cfe79e522
commit 7525d60e35cce3488358493bc520eb2cfe79e522
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Sun Sep 30 20:25:20 2012 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Sun Sep 30 20:36:40 2012 +0200

    CTest: fix usage of memory checker with spaces in path
    
    The filename was escaped in cmCTestMemCheckHandler::InitializeMemoryChecking()
    and again before it was written to output in
    cmCTestRunTest::ComputeArguments().
    
    Once someone uses e.g. a valgrind path with spaces this leads to double escaping
    making the memory checker fail completely because of the invalid path.

diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index a2a16d3..f446c94 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -247,7 +247,8 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
 {
   std::vector<cmStdString>::size_type pp;
   std::string memcheckcommand = "";
-  memcheckcommand = this->MemoryTester;
+  memcheckcommand
+    = cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str());
   for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ )
     {
     args.push_back(this->MemoryTesterOptions[pp]);
@@ -410,29 +411,25 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
         "MemoryCheckCommand").c_str()) )
     {
     this->MemoryTester
-      = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
-          "MemoryCheckCommand").c_str());
+      = this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str();
     }
   else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
         "PurifyCommand").c_str()) )
     {
     this->MemoryTester
-      = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
-          "PurifyCommand").c_str());
+      = this->CTest->GetCTestConfiguration("PurifyCommand").c_str();
     }
   else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
         "ValgrindCommand").c_str()) )
     {
     this->MemoryTester
-      = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
-          "ValgrindCommand").c_str());
+      = this->CTest->GetCTestConfiguration("ValgrindCommand").c_str();
     }
   else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
         "BoundsCheckerCommand").c_str()) )
     {
     this->MemoryTester
-      = cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration(
-          "BoundsCheckerCommand").c_str());
+      = this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
     }
   else
     {

-----------------------------------------------------------------------

Summary of changes:
 Source/CTest/cmCTestMemCheckHandler.cxx |  169 +++++++++++++++++--------------
 1 files changed, 93 insertions(+), 76 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list