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:
parent
bcc0f3fb05
commit
dde6306a48
|
@ -491,6 +491,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
switch ( this->MemoryTesterStyle )
|
switch ( this->MemoryTesterStyle )
|
||||||
{
|
{
|
||||||
case cmCTestMemCheckHandler::VALGRIND:
|
case cmCTestMemCheckHandler::VALGRIND:
|
||||||
|
{
|
||||||
if ( this->MemoryTesterOptions.empty() )
|
if ( this->MemoryTesterOptions.empty() )
|
||||||
{
|
{
|
||||||
this->MemoryTesterOptions.push_back("-q");
|
this->MemoryTesterOptions.push_back("-q");
|
||||||
|
@ -516,7 +517,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
+ this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
|
+ this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
|
||||||
this->MemoryTesterOptions.push_back(suppressions);
|
this->MemoryTesterOptions.push_back(suppressions);
|
||||||
}
|
}
|
||||||
|
std::string outputFile = "--log-file="
|
||||||
|
+ this->MemoryTesterOutputFile;
|
||||||
|
this->MemoryTesterOptions.push_back(outputFile);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case cmCTestMemCheckHandler::PURIFY:
|
case cmCTestMemCheckHandler::PURIFY:
|
||||||
{
|
{
|
||||||
std::string outputFile;
|
std::string outputFile;
|
||||||
|
@ -948,6 +953,21 @@ cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res)
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"PostProcessPurifyTest for : "
|
"PostProcessPurifyTest for : "
|
||||||
<< res.Name.c_str() << std::endl);
|
<< 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()) )
|
if ( !cmSystemTools::FileExists(this->MemoryTesterOutputFile.c_str()) )
|
||||||
{
|
{
|
||||||
std::string log = "Cannot find memory tester output file: "
|
std::string log = "Cannot find memory tester output file: "
|
||||||
|
|
|
@ -119,6 +119,10 @@ private:
|
||||||
|
|
||||||
void PostProcessPurifyTest(cmCTestTestResult& res);
|
void PostProcessPurifyTest(cmCTestTestResult& res);
|
||||||
void PostProcessBoundsCheckerTest(cmCTestTestResult& res);
|
void PostProcessBoundsCheckerTest(cmCTestTestResult& res);
|
||||||
|
void PostProcessValgrindTest(cmCTestTestResult& res);
|
||||||
|
|
||||||
|
///! append MemoryTesterOutputFile to the test log
|
||||||
|
void appendMemTesterOutput(cmCTestTestHandler::cmCTestTestResult& res);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -384,13 +384,19 @@ void cmCTestRunTest::MemCheckPostProcess()
|
||||||
<< this->TestResult.Name.c_str() << std::endl);
|
<< this->TestResult.Name.c_str() << std::endl);
|
||||||
cmCTestMemCheckHandler * handler = static_cast<cmCTestMemCheckHandler*>
|
cmCTestMemCheckHandler * handler = static_cast<cmCTestMemCheckHandler*>
|
||||||
(this->TestHandler);
|
(this->TestHandler);
|
||||||
if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER)
|
switch ( handler->MemoryTesterStyle )
|
||||||
{
|
|
||||||
handler->PostProcessBoundsCheckerTest(this->TestResult);
|
|
||||||
}
|
|
||||||
else if(handler->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY)
|
|
||||||
{
|
{
|
||||||
|
case cmCTestMemCheckHandler::VALGRIND:
|
||||||
|
handler->PostProcessValgrindTest(this->TestResult);
|
||||||
|
break;
|
||||||
|
case cmCTestMemCheckHandler::PURIFY:
|
||||||
handler->PostProcessPurifyTest(this->TestResult);
|
handler->PostProcessPurifyTest(this->TestResult);
|
||||||
|
break;
|
||||||
|
case cmCTestMemCheckHandler::BOUNDS_CHECKER:
|
||||||
|
handler->PostProcessBoundsCheckerTest(this->TestResult);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue