CTest: use an output file for Valgrind (#14110)

This makes sure Valgrind output will not screw up tests that match on the
output.
This commit is contained in:
Rolf Eike Beer 2013-05-04 19:03:26 +02:00
parent bcc0f3fb05
commit dde6306a48
3 changed files with 36 additions and 6 deletions

View File

@ -491,6 +491,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
switch ( this->MemoryTesterStyle )
{
case cmCTestMemCheckHandler::VALGRIND:
{
if ( this->MemoryTesterOptions.empty() )
{
this->MemoryTesterOptions.push_back("-q");
@ -516,7 +517,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 +953,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: "

View File

@ -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

View File

@ -384,13 +384,19 @@ void cmCTestRunTest::MemCheckPostProcess()
<< this->TestResult.Name.c_str() << std::endl);
cmCTestMemCheckHandler * handler = static_cast<cmCTestMemCheckHandler*>
(this->TestHandler);
if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER)
{
handler->PostProcessBoundsCheckerTest(this->TestResult);
}
else if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY)
switch ( handler->MemoryTesterStyle )
{
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;
}
}