ENH: fix output and valgrind truncation issue

This commit is contained in:
Bill Hoffman 2007-08-10 16:28:48 -04:00
parent a793daf228
commit fa46cb5572

View File

@ -202,6 +202,8 @@ cmCTestMemCheckHandler::cmCTestMemCheckHandler()
void cmCTestMemCheckHandler::Initialize() void cmCTestMemCheckHandler::Initialize()
{ {
this->Superclass::Initialize(); this->Superclass::Initialize();
this->CustomMaximumPassedTestOutputSize = 0;
this->CustomMaximumFailedTestOutputSize = 0;
this->MemoryTester = ""; this->MemoryTester = "";
this->MemoryTesterOptionsParsed.clear(); this->MemoryTesterOptionsParsed.clear();
this->MemoryTesterOptions = ""; this->MemoryTesterOptions = "";
@ -695,8 +697,13 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
bool outputFull = false; bool outputFull = false;
for ( cc = 0; cc < lines.size(); cc ++ ) for ( cc = 0; cc < lines.size(); cc ++ )
{ {
cmCTestLog(this->CTest, DEBUG, "test line "
<< lines[cc] << std::endl);
if ( valgrindLine.find(lines[cc]) ) if ( valgrindLine.find(lines[cc]) )
{ {
cmCTestLog(this->CTest, DEBUG, "valgrind line "
<< lines[cc] << std::endl);
int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT; int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT;
if ( vgFIM.find(lines[cc]) ) if ( vgFIM.find(lines[cc]) )
{ {
@ -761,16 +768,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
results[failure] ++; results[failure] ++;
defects ++; defects ++;
} }
if(!outputFull) totalOutputSize += lines[cc].size();
{ ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl;
totalOutputSize += lines[cc].size();
ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl;
if(totalOutputSize >
static_cast<size_t>(this->CustomMaximumFailedTestOutputSize))
{
outputFull = true;
}
}
} }
else else
{ {
@ -784,13 +783,18 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i) nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i)
{ {
totalOutputSize += lines[*i].size(); totalOutputSize += lines[*i].size();
cmCTestLog(this->CTest, DEBUG, "before xml safe "
<< lines[*i] << std::endl);
cmCTestLog(this->CTest, DEBUG, "after xml safe "
<< cmCTest::MakeXMLSafe(lines[*i]) << std::endl);
ostr << cmCTest::MakeXMLSafe(lines[*i]) << std::endl; ostr << cmCTest::MakeXMLSafe(lines[*i]) << std::endl;
if(!unlimitedOutput && totalOutputSize > if(!unlimitedOutput && totalOutputSize >
static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) static_cast<size_t>(this->CustomMaximumFailedTestOutputSize))
{ {
outputFull = true; outputFull = true;
ostr << "....\n"; ostr << "....\n";
ostr << "Output for this test has been truncated see testing" ostr << "Test Output for this test has been truncated see testing"
" machine logs for full output,\n"; " machine logs for full output,\n";
ostr << "or put CTEST_FULL_OUTPUT in the output of " ostr << "or put CTEST_FULL_OUTPUT in the output of "
"this test program.\n"; "this test program.\n";