diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2016-11-09 22:30:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-11-17 14:38:06 (GMT) |
commit | f0d50957b9c75963222c084c09295e63a45f08f5 (patch) | |
tree | 6647ce93cc74b2023810094a762584b633c1f10c /Source/CTest | |
parent | 4790842612b445bc49ee7af4d44f71718e292d48 (diff) | |
download | CMake-f0d50957b9c75963222c084c09295e63a45f08f5.zip CMake-f0d50957b9c75963222c084c09295e63a45f08f5.tar.gz CMake-f0d50957b9c75963222c084c09295e63a45f08f5.tar.bz2 |
ctest: Improve output for `-T memcheck`
Show how many defects each test that had a defect produced.
Also tell the user where to find the full log files.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 0f27fac..2c31f60 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -329,10 +329,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) } xml.EndElement(); // TestList cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - "-- Processing memory checking output: ", this->Quiet); + "-- Processing memory checking output:\n", this->Quiet); size_t total = this->TestResults.size(); - size_t step = total / 10; - size_t current = 0; for (cc = 0; cc < this->TestResults.size(); cc++) { cmCTestTestResult* result = &this->TestResults[cc]; std::string memcheckstr; @@ -347,18 +345,29 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)); this->WriteTestResultHeader(xml, result); xml.StartElement("Results"); + int memoryErrors = 0; for (std::vector<int>::size_type kk = 0; kk < memcheckresults.size(); ++kk) { if (memcheckresults[kk]) { xml.StartElement("Defect"); xml.Attribute("type", this->ResultStringsLong[kk]); xml.Content(memcheckresults[kk]); + memoryErrors += memcheckresults[kk]; xml.EndElement(); // Defect } this->GlobalResults[kk] += memcheckresults[kk]; } xml.EndElement(); // Results - + if (memoryErrors > 0) { + const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); + std::string outname = result->Name + " "; + outname.resize(maxTestNameWidth + 4, '.'); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, cc + 1 + << "/" << total << " MemCheck: #" + << result->TestCount << ": " << outname + << " Defects: " << memoryErrors << std::endl, + this->Quiet); + } xml.StartElement("Log"); if (this->CTest->ShouldCompressTestOutput()) { this->CTest->CompressString(memcheckstr); @@ -369,13 +378,16 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) xml.EndElement(); // Log this->WriteTestResultFooter(xml, result); - if (current < cc) { - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "#" << std::flush, - this->Quiet); - current += step; - } } - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "MemCheck log files can be found here: " + "( * corresponds to test number)" + << std::endl, + this->Quiet); + std::string output = this->MemoryTesterOutputFile; + cmSystemTools::ReplaceString(output, "??", "*"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, output << std::endl, + this->Quiet); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:" << std::endl, this->Quiet); xml.StartElement("DefectList"); |