diff options
author | Zack Galbreath <zack.galbreath@kitware.com> | 2015-02-17 22:15:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-23 15:02:00 (GMT) |
commit | 0b87b2a33902ac000a0073a1def887599c69809d (patch) | |
tree | b77cde58d8b5ec825db9edb5610ff0e246e34dc3 | |
parent | fc58bdb9ad90ddd41c5336bc1ab2e35fa0f74d41 (diff) | |
download | CMake-0b87b2a33902ac000a0073a1def887599c69809d.zip CMake-0b87b2a33902ac000a0073a1def887599c69809d.tar.gz CMake-0b87b2a33902ac000a0073a1def887599c69809d.tar.bz2 |
ctest_memcheck: Add QUIET option
-rw-r--r-- | Help/command/ctest_memcheck.rst | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckCommand.cxx | 14 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 77 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 14 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_memcheck/DummyQuiet-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_memcheck/test.cmake.in | 2 |
7 files changed, 65 insertions, 48 deletions
diff --git a/Help/command/ctest_memcheck.rst b/Help/command/ctest_memcheck.rst index ca47ed0..56a2490 100644 --- a/Help/command/ctest_memcheck.rst +++ b/Help/command/ctest_memcheck.rst @@ -26,3 +26,7 @@ the number of tests to be run in parallel. The APPEND option marks results for append to those previously submitted to a dashboard server since the last ctest_start. Append semantics are defined by the dashboard server in use. + +The QUIET option suppresses any CTest-specific non-error messages +that would have otherwise been printed to the console. Output from +the underlying tests are not affected. diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index f144066..b379d32 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -21,16 +21,20 @@ cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler() = this->CTest->GetInitializedHandler("memcheck"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE"); + "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckSanitizerOptions", "CTEST_MEMORYCHECK_SANITIZER_OPTIONS"); + "MemoryCheckSanitizerOptions", "CTEST_MEMORYCHECK_SANITIZER_OPTIONS", + this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND"); + "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS"); + "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS", + this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "MemoryCheckSuppressionFile", "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE"); + "MemoryCheckSuppressionFile", "CTEST_MEMORYCHECK_SUPPRESSIONS_FILE", + this->Quiet); + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index d4ff24f..061f3fd 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -251,8 +251,8 @@ void cmCTestMemCheckHandler::GenerateTestCommand( memcheckcommand += " " + memTesterEnvironmentVariable; args.push_back(memTesterEnvironmentVariable); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: " - << memcheckcommand << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Memory check command: " << memcheckcommand << std::endl, this->Quiet); } //---------------------------------------------------------------------- @@ -347,7 +347,8 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf) "CTEST_CUSTOM_MEMCHECK_IGNORE", this->CustomTestsIgnore); std::string cmake = cmSystemTools::GetCMakeCommand(); - this->CTest->SetCTestConfiguration("CMakeCommand", cmake.c_str()); + this->CTest->SetCTestConfiguration("CMakeCommand", cmake.c_str(), + this->Quiet); } //---------------------------------------------------------------------- @@ -400,8 +401,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) << "</Test>" << std::endl; } os << "\t</TestList>\n"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, - "-- Processing memory checking output: "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "-- Processing memory checking output: ", this->Quiet); size_t total = this->TestResults.size(); size_t step = total / 10; size_t current = 0; @@ -451,13 +452,14 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) this->WriteTestResultFooter(os, result); if ( current < cc ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "#" << std::flush); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "#" << std::flush, + this->Quiet); current += step; } } - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:" + << std::endl, this->Quiet); os << "\t<DefectList>" << std::endl; for ( cc = 0; cc < this->GlobalResults.size(); cc ++ ) { @@ -468,9 +470,9 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) #endif std::cerr.width(35); #define cerr no_cerr - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->ResultStringsLong[cc] << " - " - << this->GlobalResults[cc] << std::endl); + << this->GlobalResults[cc] << std::endl, this->Quiet); os << "\t\t<Defect Type=\"" << this->ResultStringsLong[cc] << "\"/>" << std::endl; } @@ -594,10 +596,10 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() } if(this->MemoryTester.empty()) { - cmCTestLog(this->CTest, WARNING, + cmCTestOptionalLog(this->CTest, WARNING, "Memory checker (MemoryCheckCommand) " "not set, or cannot find the specified program." - << std::endl); + << std::endl, this->Quiet); return false; } @@ -981,17 +983,18 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( "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); + cmCTestOptionalLog(this->CTest, DEBUG, + "Start test: " << lines.size() << std::endl, this->Quiet); std::string::size_type totalOutputSize = 0; for ( cc = 0; cc < lines.size(); cc ++ ) { - cmCTestLog(this->CTest, DEBUG, "test line " - << lines[cc] << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "test line " + << lines[cc] << std::endl, this->Quiet); if ( valgrindLine.find(lines[cc]) ) { - cmCTestLog(this->CTest, DEBUG, "valgrind line " - << lines[cc] << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "valgrind line " + << lines[cc] << std::endl, this->Quiet); int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT; if ( vgFIM.find(lines[cc]) ) { @@ -1075,10 +1078,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i) { totalOutputSize += lines[*i].size(); - cmCTestLog(this->CTest, DEBUG, "before xml safe " - << lines[*i] << std::endl); - cmCTestLog(this->CTest, DEBUG, "after xml safe " - << cmXMLSafe(lines[*i]) << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "before xml safe " + << lines[*i] << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, DEBUG, "after xml safe " + << cmXMLSafe(lines[*i]) << std::endl, this->Quiet); ostr << cmXMLSafe(lines[*i]) << std::endl; if(!unlimitedOutput && totalOutputSize > static_cast<size_t>(this->CustomMaximumFailedTestOutputSize)) @@ -1091,8 +1094,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( break; // stop the copy of output if we are full } } - cmCTestLog(this->CTest, DEBUG, "End test (elapsed: " - << (cmSystemTools::GetTime() - sttime) << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End test (elapsed: " + << (cmSystemTools::GetTime() - sttime) << std::endl, this->Quiet); log = ostr.str(); if ( defects ) { @@ -1112,7 +1115,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( double sttime = cmSystemTools::GetTime(); std::vector<std::string> lines; cmSystemTools::Split(str.c_str(), lines); - cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Start test: " << lines.size() << std::endl, this->Quiet); std::vector<std::string>::size_type cc; for ( cc = 0; cc < lines.size(); cc ++ ) { @@ -1148,8 +1152,8 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( results[parser.Errors[cc]]++; defects++; } - cmCTestLog(this->CTest, DEBUG, "End test (elapsed: " - << (cmSystemTools::GetTime() - sttime) << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End test (elapsed: " + << (cmSystemTools::GetTime() - sttime) << std::endl, this->Quiet); if(defects) { // only put the output of Bounds Checker if there were @@ -1165,9 +1169,9 @@ void cmCTestMemCheckHandler::PostProcessTest(cmCTestTestResult& res, int test) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessTest memcheck results for : " - << res.Name << std::endl); + << res.Name << std::endl, this->Quiet); if(this->MemoryTesterStyle == cmCTestMemCheckHandler::BOUNDS_CHECKER) { @@ -1192,9 +1196,9 @@ void cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, int test) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " - << res.Name << std::endl); + << res.Name << std::endl, this->Quiet); std::vector<std::string> files; this->TestOutputFileNames(test, files); if (files.empty()) @@ -1226,11 +1230,11 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, } cmSystemTools::Delay(1000); cmSystemTools::RemoveFile(this->BoundsCheckerDPBDFile); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " - << this->BoundsCheckerDPBDFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " + << this->BoundsCheckerDPBDFile << std::endl, this->Quiet); cmSystemTools::RemoveFile(this->BoundsCheckerXMLFile); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " - << this->BoundsCheckerXMLFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " + << this->BoundsCheckerXMLFile << std::endl, this->Quiet); } void @@ -1260,7 +1264,8 @@ cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, if(this->LogWithPID) { cmSystemTools::RemoveFile(ofile); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: "<< ofile <<"\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Remove: "<< ofile <<"\n", this->Quiet); } } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 314c8ad..03131fd 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -386,10 +386,11 @@ void cmCTestRunTest::MemCheckPostProcess() { return; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index - << ": process test output now: " - << this->TestProperties->Name << " " - << this->TestResult.Name << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index + << ": process test output now: " + << this->TestProperties->Name << " " + << this->TestResult.Name << std::endl, + this->TestHandler->GetQuiet()); cmCTestMemCheckHandler * handler = static_cast<cmCTestMemCheckHandler*> (this->TestHandler); handler->PostProcessTest(this->TestResult, this->Index); @@ -661,8 +662,9 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, { timeout = 0; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " - << "Test timeout computed to be: " << timeout << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " + << "Test timeout computed to be: " << timeout << "\n", + this->TestHandler->GetQuiet()); this->TestProcess->SetTimeout(timeout); diff --git a/Tests/RunCMake/ctest_memcheck/DummyQuiet-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyQuiet-stdout.txt new file mode 100644 index 0000000..58f55a5 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyQuiet-stdout.txt @@ -0,0 +1 @@ +0 tests failed out of 1$ diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake index b1793fa..6c96a26 100644 --- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake @@ -130,3 +130,4 @@ run_mc_test(DummyValgrindNoLogFile "${PSEUDO_VALGRIND_NOLOG}") run_mc_test(DummyBCNoLogFile "${PSEUDO_BC_NOLOG}") run_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") run_mc_test(Unknown "\${CMAKE_COMMAND}") +run_mc_test(DummyQuiet "${PSEUDO_VALGRIND}" -DMEMCHECK_ARGS=QUIET) diff --git a/Tests/RunCMake/ctest_memcheck/test.cmake.in b/Tests/RunCMake/ctest_memcheck/test.cmake.in index f9c1ba9..8431fa6 100644 --- a/Tests/RunCMake/ctest_memcheck/test.cmake.in +++ b/Tests/RunCMake/ctest_memcheck/test.cmake.in @@ -21,4 +21,4 @@ set(CTEST_MEMORYCHECK_TYPE "${MEMCHECK_TYPE}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res ${MEMCHECK_ARGS}) |