diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-07-26 20:38:00 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-07-26 20:38:00 (GMT) |
commit | 3017259ac468447c2f0284933551e62cb44ae83c (patch) | |
tree | f63a0d00d51c56488dfd93478db1c9ee4aa06922 /Source/CTest/cmCTestMemCheckHandler.cxx | |
parent | 3f00d3cbc9f24b58f2a2b446f6ca630633c1a0c8 (diff) | |
download | CMake-3017259ac468447c2f0284933551e62cb44ae83c.zip CMake-3017259ac468447c2f0284933551e62cb44ae83c.tar.gz CMake-3017259ac468447c2f0284933551e62cb44ae83c.tar.bz2 |
ENH: add test output to valgrind output and truncate output for valgrind
Diffstat (limited to 'Source/CTest/cmCTestMemCheckHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 2367b26..0539f4a 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -644,7 +644,13 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( { std::vector<cmStdString> lines; cmSystemTools::Split(str.c_str(), lines); - + bool unlimitedOutput = false; + if(str.find("CTEST_FULL_OUTPUT") != str.npos || + this->CustomMaximumFailedTestOutputSize == 0) + { + unlimitedOutput = true; + } + std::string::size_type cc; cmOStringStream ostr; @@ -680,9 +686,11 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( cmsys::RegularExpression vgIPW("== .*Invalid write of size [0-9]"); cmsys::RegularExpression vgABR("== .*pthread_mutex_unlock: mutex is " "locked by a different thread"); - + std::vector<std::string::size_type> nonValGrindOutput; double sttime = cmSystemTools::GetTime(); cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl); + std::string::size_type totalOutputSize = 0; + bool outputFull = false; for ( cc = 0; cc < lines.size(); cc ++ ) { if ( valgrindLine.find(lines[cc]) ) @@ -747,7 +755,38 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( results[failure] ++; defects ++; } - ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl; + if(!outputFull) + { + totalOutputSize += lines[cc].size(); + ostr << cmCTest::MakeXMLSafe(lines[cc]) << std::endl; + if(totalOutputSize > + static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) + { + outputFull = true; + } + } + } + else + { + nonValGrindOutput.push_back(cc); + } + } + // Now put all all the non valgrind output into the test output + if(!outputFull) + { + for(std::vector<std::string::size_type>::iterator i = + nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i) + { + totalOutputSize += lines[*i].size(); + ostr << cmCTest::MakeXMLSafe(lines[*i]) << std::endl; + if(!unlimitedOutput && totalOutputSize > + static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) + { + outputFull = true; + ostr << "....\n"; + ostr << "Output for this test has been truncated see testing machine logs for full output,\n"; + ostr << "or put CTEST_FULL_OUTPUT in the output of this test program.\n"; + } } } cmCTestLog(this->CTest, DEBUG, "End test (elapsed: " |