summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-16 18:38:35 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-05-16 18:38:35 (GMT)
commite477f21af2b9200a93f9f83c3663cb1a919abe7c (patch)
tree9c9d8ff9dc20d6159d66754d098675a6c621e7e1 /Source/CTest
parent62a9bdb466248a7726dd23da765ee63eb113fc52 (diff)
parent10bc50eacf2263719161cab19d4e576dcff2589b (diff)
downloadCMake-e477f21af2b9200a93f9f83c3663cb1a919abe7c.zip
CMake-e477f21af2b9200a93f9f83c3663cb1a919abe7c.tar.gz
CMake-e477f21af2b9200a93f9f83c3663cb1a919abe7c.tar.bz2
Merge topic 'MemChecker-improvements'
10bc50e Tests: ignore Guard Malloc messages in MemChecker tests 159c3e9 Tests: add a test with custom options passed to valgrind 61ddb93 CTest: fix comment documenting cmBoundsCheckerParser class cbdfcb0 Tests: add test for non-existent Valgrind suppression file 3b5b758 CTest: drop suppression for gcc 2.9.6 errors from default Valgrind flags 7752253 Tests: verify that memory checker output files are always present abf1df4 Tests: remove code duplication in CTestTestMemCheck tests f499422 CTest: remove unreachable code and CTestTestMemcheckUnknown test dde6306 CTest: use an output file for Valgrind (#14110) bcc0f3f Tests: create output files for all memory checkers
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx31
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h4
-rw-r--r--Source/CTest/cmCTestRunTest.cxx18
3 files changed, 37 insertions, 16 deletions
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 80218ad..8baa673 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -43,8 +43,7 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = {
{0,0}
};
-// parse the xml file storing the installed version of Xcode on
-// the machine
+// parse the xml file containing the results of last BoundsChecker run
class cmBoundsCheckerParser : public cmXMLParser
{
public:
@@ -461,13 +460,6 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
return false;
}
- if ( this->MemoryTester[0] == '\"' &&
- this->MemoryTester[this->MemoryTester.size()-1] == '\"' )
- {
- this->MemoryTester
- = this->MemoryTester.substr(1, this->MemoryTester.size()-2);
- }
-
// Setup the options
std::string memoryTesterOptions;
if ( this->CTest->GetCTestConfiguration(
@@ -491,13 +483,13 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
switch ( this->MemoryTesterStyle )
{
case 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(
@@ -516,7 +508,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
+ this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
this->MemoryTesterOptions.push_back(suppressions);
}
+ std::string outputFile = "--log-file="
+ + this->MemoryTesterOutputFile;
+ this->MemoryTesterOptions.push_back(outputFile);
break;
+ }
case cmCTestMemCheckHandler::PURIFY:
{
std::string outputFile;
@@ -948,6 +944,21 @@ cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res)
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"PostProcessPurifyTest for : "
<< res.Name.c_str() << std::endl);
+ appendMemTesterOutput(res);
+}
+
+void
+cmCTestMemCheckHandler::PostProcessValgrindTest(cmCTestTestResult& res)
+{
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "PostProcessValgrindTest for : "
+ << res.Name.c_str() << std::endl);
+ appendMemTesterOutput(res);
+}
+
+void
+cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res)
+{
if ( !cmSystemTools::FileExists(this->MemoryTesterOutputFile.c_str()) )
{
std::string log = "Cannot find memory tester output file: "
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index 1e81c89..0a8c1b3 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -119,6 +119,10 @@ private:
void PostProcessPurifyTest(cmCTestTestResult& res);
void PostProcessBoundsCheckerTest(cmCTestTestResult& res);
+ void PostProcessValgrindTest(cmCTestTestResult& res);
+
+ ///! append MemoryTesterOutputFile to the test log
+ void appendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res);
};
#endif
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index fc1bcb5..ddd7e45 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -386,13 +386,19 @@ void cmCTestRunTest::MemCheckPostProcess()
<< this->TestResult.Name.c_str() << std::endl);
cmCTestMemCheckHandler * handler = static_cast<cmCTestMemCheckHandler*>
(this->TestHandler);
- if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER)
+ switch ( handler->MemoryTesterStyle )
{
- handler->PostProcessBoundsCheckerTest(this->TestResult);
- }
- else if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY)
- {
- handler->PostProcessPurifyTest(this->TestResult);
+ case cmCTestMemCheckHandler::VALGRIND:
+ handler->PostProcessValgrindTest(this->TestResult);
+ break;
+ case cmCTestMemCheckHandler::PURIFY:
+ handler->PostProcessPurifyTest(this->TestResult);
+ break;
+ case cmCTestMemCheckHandler::BOUNDS_CHECKER:
+ handler->PostProcessBoundsCheckerTest(this->TestResult);
+ break;
+ default:
+ break;
}
}