diff options
Diffstat (limited to 'Source')
34 files changed, 723 insertions, 576 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bee5291..12242a3 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150223) +set(CMake_VERSION_PATCH 20150224) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index c4df741..2b36b0a 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -58,7 +58,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() = this->Makefile->GetDefinition("CTEST_BUILD_COMMAND"); if ( ctestBuildCommand && *ctestBuildCommand ) { - this->CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand); + this->CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand, + this->Quiet); } else { @@ -141,10 +142,10 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "", cmakeBuildConfiguration, cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "SetMakeCommand:" - << buildCommand << "\n"); - this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str()); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "SetMakeCommand:" << buildCommand << "\n", this->Quiet); + this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str(), + this->Quiet); } else { @@ -168,9 +169,11 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() if(const char* useLaunchers = this->Makefile->GetDefinition("CTEST_USE_LAUNCHERS")) { - this->CTest->SetCTestConfiguration("UseLaunchers", useLaunchers); + this->CTest->SetCTestConfiguration("UseLaunchers", useLaunchers, + this->Quiet); } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index f941408..fe27e2b 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -286,9 +286,9 @@ std::string cmCTestBuildHandler::GetMakeCommand() { std::string makeCommand = this->CTest->GetCTestConfiguration("MakeCommand"); - cmCTestLog(this->CTest, - HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand << - "\n"); + cmCTestOptionalLog(this->CTest, + HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand << "\n", + this->Quiet); std::string configType = this->CTest->GetConfigType(); if (configType == "") @@ -312,7 +312,8 @@ std::string cmCTestBuildHandler::GetMakeCommand() //functions and commented... int cmCTestBuildHandler::ProcessHandler() { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Build project" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Build project" << std::endl, + this->Quiet); // do we have time for this if (this->CTest->GetRemainingTimeAllowed() < 120) @@ -401,12 +402,12 @@ int cmCTestBuildHandler::ProcessHandler() #define cmCTestBuildHandlerPopulateRegexVector(strings, regexes) \ regexes.clear(); \ - cmCTestLog(this->CTest, DEBUG, this << "Add " #regexes \ - << std::endl); \ + cmCTestOptionalLog(this->CTest, DEBUG, this << "Add " #regexes \ + << std::endl, this->Quiet); \ for ( it = strings.begin(); it != strings.end(); ++it ) \ { \ - cmCTestLog(this->CTest, DEBUG, "Add " #strings ": " \ - << *it << std::endl); \ + cmCTestOptionalLog(this->CTest, DEBUG, "Add " #strings ": " \ + << *it << std::endl, this->Quiet); \ regexes.push_back(it->c_str()); \ } cmCTestBuildHandlerPopulateRegexVector( @@ -472,8 +473,8 @@ int cmCTestBuildHandler::ProcessHandler() } else { - cmCTestLog(this->CTest, DEBUG, "Build with command: " << makeCommand - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Build with command: " << + makeCommand << std::endl, this->Quiet); } // Remember end build time and calculate elapsed time @@ -906,13 +907,16 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, } argv.push_back(0); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command:"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command:", + this->Quiet); std::vector<const char*>::iterator ait; for ( ait = argv.begin(); ait != argv.end() && *ait; ++ ait ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << "\""); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << + "\"", this->Quiet); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl, + this->Quiet); // Optionally use make rule launchers to record errors and warnings. LaunchHelper launchHelper(this); @@ -932,12 +936,12 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, char* data; int length; - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Each symbol represents " << tick_len << " bytes of output." << std::endl << (this->UseCTestLaunch? "" : " '!' represents an error and '*' a warning.\n") - << " " << std::flush); + << " " << std::flush, this->Quiet); // Initialize building structures this->BuildProcessingQueue.clear(); @@ -980,8 +984,9 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingQueue); this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingErrorQueue); - cmCTestLog(this->CTest, OUTPUT, " Size of output: " - << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl); + cmCTestOptionalLog(this->CTest, OUTPUT, " Size of output: " + << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl, + this->Quiet); // Properly handle output of the build command cmsysProcess_WaitForExit(cp, 0); @@ -992,8 +997,8 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, if (retVal) { *retVal = cmsysProcess_GetExitValue(cp); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Command exited with the value: " << *retVal << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Command exited with the value: " << *retVal << std::endl, this->Quiet); // if a non zero return value if (*retVal) { @@ -1017,13 +1022,14 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, if (retVal) { *retVal = cmsysProcess_GetExitException(cp); - cmCTestLog(this->CTest, WARNING, "There was an exception: " << *retVal - << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "There was an exception: " << + *retVal << std::endl, this->Quiet); } } else if(result == cmsysProcess_State_Expired) { - cmCTestLog(this->CTest, WARNING, "There was a timeout" << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "There was a timeout" << + std::endl, this->Quiet); } else if(result == cmsysProcess_State_Error) { @@ -1185,13 +1191,14 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, while ( this->BuildOutputLogSize > (tick * tick_len) ) { tick ++; - cmCTestLog(this->CTest, HANDLER_OUTPUT, this->LastTickChar); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->LastTickChar, + this->Quiet); tickDisplayed = true; if ( tick % tick_line_len == 0 && tick > 0 ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Size: " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Size: " << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl - << " "); + << " ", this->Quiet); } } if ( tickDisplayed ) @@ -1216,7 +1223,8 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) return b_REGULAR_LINE; } - cmCTestLog(this->CTest, DEBUG, "Line: [" << data << "]" << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Line: [" << data << "]" << + std::endl, this->Quiet); std::vector<cmsys::RegularExpression>::iterator it; @@ -1236,9 +1244,9 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if ( it->find(data) ) { errorLine = 1; - cmCTestLog(this->CTest, DEBUG, " Error Line: " << data + cmCTestOptionalLog(this->CTest, DEBUG, " Error Line: " << data << " (matches: " << this->CustomErrorMatches[wrxCnt] << ")" - << std::endl); + << std::endl, this->Quiet); break; } wrxCnt ++; @@ -1252,9 +1260,9 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if ( it->find(data) ) { errorLine = 0; - cmCTestLog(this->CTest, DEBUG, " Not an error Line: " << data + cmCTestOptionalLog(this->CTest, DEBUG, " Not an error Line: " << data << " (matches: " << this->CustomErrorExceptions[wrxCnt] << ")" - << std::endl); + << std::endl, this->Quiet); break; } wrxCnt ++; @@ -1271,10 +1279,10 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if ( it->find(data) ) { warningLine = 1; - cmCTestLog(this->CTest, DEBUG, + cmCTestOptionalLog(this->CTest, DEBUG, " Warning Line: " << data << " (matches: " << this->CustomWarningMatches[wrxCnt] << ")" - << std::endl); + << std::endl, this->Quiet); break; } wrxCnt ++; @@ -1289,9 +1297,9 @@ int cmCTestBuildHandler::ProcessSingleLine(const char* data) if ( it->find(data) ) { warningLine = 0; - cmCTestLog(this->CTest, DEBUG, " Not a warning Line: " << data + cmCTestOptionalLog(this->CTest, DEBUG, " Not a warning Line: " << data << " (matches: " << this->CustomWarningExceptions[wrxCnt] << ")" - << std::endl); + << std::endl, this->Quiet); break; } wrxCnt ++; diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 0f13263..ba4dab2 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -45,7 +45,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() if ( ctestConfigureCommand && *ctestConfigureCommand ) { this->CTest->SetCTestConfiguration("ConfigureCommand", - ctestConfigureCommand); + ctestConfigureCommand, this->Quiet); } else { @@ -141,7 +141,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmakeConfigureCommand += "\""; this->CTest->SetCTestConfiguration("ConfigureCommand", - cmakeConfigureCommand.c_str()); + cmakeConfigureCommand.c_str(), this->Quiet); } else { @@ -160,5 +160,6 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() "internal CTest error. Cannot instantiate configure handler"); return 0; } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 506433f..3b444f2 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -35,7 +35,8 @@ void cmCTestConfigureHandler::Initialize() //functions and commented... int cmCTestConfigureHandler::ProcessHandler() { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Configure project" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "Configure project" << std::endl, this->Quiet); std::string cCommand = this->CTest->GetCTestConfiguration("ConfigureCommand"); if (cCommand.empty()) @@ -75,8 +76,8 @@ int cmCTestConfigureHandler::ProcessHandler() cmGeneratedFileStream ofs; this->StartLogFile("Configure", ofs); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: " - << cCommand << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Configure with command: " << cCommand << std::endl, this->Quiet); res = this->CTest->RunMakeCommand(cCommand.c_str(), output, &retVal, buildDirectory.c_str(), 0, ofs); @@ -101,7 +102,7 @@ int cmCTestConfigureHandler::ProcessHandler() } os << "<ConfigureCommand>" << cCommand << "</ConfigureCommand>" << std::endl; - cmCTestLog(this->CTest, DEBUG, "End" << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet); os << "<Log>" << cmXMLSafe(output) << "</Log>" << std::endl; std::string end_time = this->CTest->CurrentTime(); os << "\t<ConfigureStatus>" << retVal << "</ConfigureStatus>\n" @@ -119,8 +120,8 @@ int cmCTestConfigureHandler::ProcessHandler() } else { - cmCTestLog(this->CTest, DEBUG, "Configure with command: " << cCommand - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Configure with command: " << cCommand << std::endl, this->Quiet); } if (! res || retVal ) { diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx index 41f016b..f1f935b 100644 --- a/Source/CTest/cmCTestCoverageCommand.cxx +++ b/Source/CTest/cmCTestCoverageCommand.cxx @@ -24,9 +24,9 @@ cmCTestCoverageCommand::cmCTestCoverageCommand() cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler() { this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CoverageCommand", "CTEST_COVERAGE_COMMAND"); + "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS"); + "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS", this->Quiet); cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>( this->CTest->GetInitializedHandler("coverage")); if ( !handler ) @@ -41,6 +41,7 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler() handler->SetLabelFilter(this->Labels); } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 1226d22..790e488 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -176,8 +176,8 @@ bool cmCTestCoverageHandler::StartCoverageLogFile( { char covLogFilename[1024]; sprintf(covLogFilename, "CoverageLog-%d", logFileCount); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " - << covLogFilename << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: " + << covLogFilename << std::endl, this->Quiet); if(!this->StartResultingXML(cmCTest::PartCoverage, covLogFilename, covLogFile)) { @@ -209,8 +209,8 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr, this->CTest->EndXML(ostr); char covLogFilename[1024]; sprintf(covLogFilename, "CoverageLog-%d.xml", logFileCount); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Close file: " - << covLogFilename << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Close file: " + << covLogFilename << std::endl, this->Quiet); ostr.Close(); } @@ -230,8 +230,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, { if ( sit->find(file) ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " File " << file - << " is excluded in CTestCustom.ctest" << std::endl;); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " File " << file + << " is excluded in CTestCustom.ctest" << std::endl;, this->Quiet); return false; } } @@ -272,8 +272,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, fFile.c_str(), checkDir.c_str()); if (!ndc.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc - << " so skip coverage of " << file << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc + << " so skip coverage of " << file << std::endl, this->Quiet); return false; } @@ -311,8 +311,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, fFile.c_str(), checkDir.c_str()); if (!ndc.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc - << " so skip coverage of: " << file << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc + << " so skip coverage of: " << file << std::endl, this->Quiet); return false; } // Ok, nothing in source tree, nothing in binary tree @@ -356,13 +356,15 @@ int cmCTestCoverageHandler::ProcessHandler() cmSystemTools::ConvertToUnixSlashes(sourceDir); cmSystemTools::ConvertToUnixSlashes(binaryDir); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Performing coverage" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "Performing coverage" << std::endl, this->Quiet); cmCTestCoverageHandlerContainer cont; cont.Error = error; cont.SourceDir = sourceDir; cont.BinaryDir = binaryDir; cont.OFS = &ofs; + cont.Quiet = this->Quiet; // setup the regex exclude stuff this->CustomCoverageExcludeRegex.clear(); @@ -442,9 +444,9 @@ int cmCTestCoverageHandler::ProcessHandler() if ( file_count == 0 ) { - cmCTestLog(this->CTest, WARNING, + cmCTestOptionalLog(this->CTest, WARNING, " Cannot find any coverage files. Ignoring Coverage request." - << std::endl); + << std::endl, this->Quiet); return error; } cmGeneratedFileStream covSumFile; @@ -476,10 +478,11 @@ int cmCTestCoverageHandler::ProcessHandler() long total_untested = 0; //std::string fullSourceDir = sourceDir + "/"; //std::string fullBinaryDir = binaryDir + "/"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Accumulating results (each . represents one file):" << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Accumulating results (each . represents one file):" << std::endl, + this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); std::vector<std::string> errorsWhileAccumulating; @@ -488,14 +491,16 @@ int cmCTestCoverageHandler::ProcessHandler() fileIterator != cont.TotalCoverage.end(); ++fileIterator ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, + this->Quiet); file_count ++; if ( file_count % 50 == 0 ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " processed: " + << file_count << " out of " - << cont.TotalCoverage.size() << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + << cont.TotalCoverage.size() << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); } const std::string fullFileName = fileIterator->first; @@ -504,15 +509,15 @@ int cmCTestCoverageHandler::ProcessHandler() sourceDir.c_str(), binaryDir.c_str()); if ( !shouldIDoCoverage ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, ".NoDartCoverage found, so skip coverage check for: " << fullFileName - << std::endl); + << std::endl, this->Quiet); continue; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Process file: " << fullFileName << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Process file: " << fullFileName << std::endl, this->Quiet); if ( !cmSystemTools::FileExists(fullFileName.c_str()) ) { @@ -556,8 +561,9 @@ int cmCTestCoverageHandler::ProcessHandler() cmCTestCoverageHandlerContainer::SingleFileCoverageVector::size_type cc; std::string line; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Actually performing coverage for: " << fullFileName << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Actually performing coverage for: " << fullFileName << std::endl, + this->Quiet); for ( cc= 0; cc < fcov.size(); cc ++ ) { if ( !cmSystemTools::GetLineFromStream(ifs, line) && @@ -641,8 +647,8 @@ int cmCTestCoverageHandler::ProcessHandler() } int untested = 0; std::string line; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Actually performing coverage for: " << *i << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Actually performing coverage for: " << *i << std::endl, this->Quiet); while (cmSystemTools::GetLineFromStream(ifs, line)) { covLogFile << "\t\t<Line Number=\"" << untested << "\" Count=\"0\">" @@ -736,8 +742,8 @@ int cmCTestCoverageHandler::ProcessHandler() //---------------------------------------------------------------------- void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Add coverage exclude regular expressions." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Add coverage exclude regular expressions." << std::endl, this->Quiet); this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE", this->CustomCoverageExclude); this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB", @@ -747,14 +753,14 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) it != this->CustomCoverageExclude.end(); ++ it ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: " - << *it << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Add coverage exclude: " << *it << std::endl, this->Quiet); } for ( it = this->ExtraCoverageGlobs.begin(); it != this->ExtraCoverageGlobs.end(); ++it) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage glob: " - << *it << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Add coverage glob: " << *it << std::endl, this->Quiet); } } @@ -812,16 +818,16 @@ int cmCTestCoverageHandler::HandleCoberturaCoverage( if(cmSystemTools::FileExists(coverageXMLFile.c_str())) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cobertura XML file: " << coverageXMLFile - << std::endl); + << std::endl, this->Quiet); cov.ReadCoverageXML(coverageXMLFile.c_str()); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Cannot find Cobertura XML file: " << coverageXMLFile - << std::endl); + << std::endl, this->Quiet); } return static_cast<int>(cont->TotalCoverage.size()); } @@ -836,33 +842,33 @@ int cmCTestCoverageHandler::HandleMumpsCoverage( "/gtm_coverage.mcov"; if(cmSystemTools::FileExists(coverageFile.c_str())) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cache Coverage: " << coverageFile - << std::endl); + << std::endl, this->Quiet); cov.ReadCoverageFile(coverageFile.c_str()); return static_cast<int>(cont->TotalCoverage.size()); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Cannot find foobar GTM coverage file: " << coverageFile - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find GTM coverage file: " << coverageFile + << std::endl, this->Quiet); } cmParseCacheCoverage ccov(*cont, this->CTest); coverageFile = this->CTest->GetBinaryDir() + "/cache_coverage.cmcov"; if(cmSystemTools::FileExists(coverageFile.c_str())) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Parsing Cache Coverage: " << coverageFile - << std::endl); + << std::endl, this->Quiet); ccov.ReadCoverageFile(coverageFile.c_str()); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find Cache coverage file: " << coverageFile - << std::endl); + << std::endl, this->Quiet); } return static_cast<int>(cont->TotalCoverage.size()); } @@ -912,15 +918,15 @@ int cmCTestCoverageHandler::HandleJacocoCoverage( files=g.GetFiles(); if (!files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Found Jacoco Files, Performing Coverage" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found Jacoco Files, Performing Coverage" << std::endl, this->Quiet); cov.LoadCoverageData(files); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find Jacoco coverage files: " << coverageFile - << std::endl); + << std::endl, this->Quiet); } return static_cast<int>(cont->TotalCoverage.size()); } @@ -945,15 +951,16 @@ int cmCTestCoverageHandler::HandleDelphiCoverage( files=g.GetFiles(); if (!files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Found Delphi HTML Files, Performing Coverage" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found Delphi HTML Files, Performing Coverage" << std::endl, + this->Quiet); cov.LoadCoverageData(files); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find Delphi coverage files: " << coverageFile - << std::endl); + << std::endl, this->Quiet); } return static_cast<int>(cont->TotalCoverage.size()); } @@ -975,15 +982,16 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage( files=g.GetFiles(); if (!files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Found BlanketJS output JSON, Performing Coverage" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found BlanketJS output JSON, Performing Coverage" << std::endl, + this->Quiet); cov.LoadCoverageData(files); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find BlanketJS coverage files: " << coverageFile - << std::endl); + << std::endl, this->Quiet); } return static_cast<int>(cont->TotalCoverage.size()); } @@ -1039,9 +1047,9 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if (files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any GCov coverage files." - << std::endl); + << std::endl, this->Quiet); // No coverage files is a valid thing, so the exit code is 0 return 0; } @@ -1057,9 +1065,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::set<std::string> missingFiles; std::string actualSourceFile = ""; - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Processing coverage (each . represents one file):" << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Processing coverage (each . represents one file):" << std::endl, + this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); int file_count = 0; // make sure output from gcov is in English! @@ -1072,7 +1081,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // for ( it = files.begin(); it != files.end(); ++ it ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, + this->Quiet); // Call gcov to get coverage data for this *.gcda file: // @@ -1082,8 +1092,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( "-o \"" + fileDir + "\" " + "\"" + *it + "\""; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() + << std::endl, this->Quiet); std::string output = ""; std::string errors = ""; @@ -1111,12 +1121,12 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << cont->Error << std::endl); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "--------------------------------------------------------------" << std::endl << output << std::endl << "--------------------------------------------------------------" - << std::endl); + << std::endl, this->Quiet); std::vector<std::string> lines; std::vector<std::string>::iterator line; @@ -1128,8 +1138,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string sourceFile; std::string gcovFile; - cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]" - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Line: [" << *line << "]" + << std::endl, this->Quiet); if (line->empty()) { @@ -1229,8 +1239,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( break; } - cmCTestLog(this->CTest, WARNING, "Warning: " << st2re4.match(1) - << " had unexpected EOF" << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "Warning: " << st2re4.match(1) + << " had unexpected EOF" << std::endl, this->Quiet); } else if ( st2re5.find(line->c_str() ) ) { @@ -1246,8 +1256,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( break; } - cmCTestLog(this->CTest, WARNING, "Warning: Cannot open file: " - << st2re5.match(1) << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "Warning: Cannot open file: " + << st2re5.match(1) << std::endl, this->Quiet); } else if ( st2re6.find(line->c_str() ) ) { @@ -1263,8 +1273,9 @@ int cmCTestCoverageHandler::HandleGCovCoverage( break; } - cmCTestLog(this->CTest, WARNING, "Warning: File: " << st2re6.match(1) - << " is newer than " << st2re6.match(2) << std::endl); + cmCTestOptionalLog(this->CTest, WARNING, "Warning: File: " + << st2re6.match(1) + << " is newer than " << st2re6.match(2) << std::endl, this->Quiet); } else { @@ -1291,8 +1302,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec = cont->TotalCoverage[actualSourceFile]; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in gcovFile: " - << gcovFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " in gcovFile: " << gcovFile << std::endl, this->Quiet); cmsys::ifstream ifile(gcovFile.c_str()); if ( ! ifile ) @@ -1366,8 +1377,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // if ( IsFileInDir(sourceFile, cont->SourceDir) ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: " - << sourceFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " produced s: " << sourceFile << std::endl, this->Quiet); *cont->OFS << " produced in source dir: " << sourceFile << std::endl; actualSourceFile @@ -1375,8 +1386,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } else if ( IsFileInDir(sourceFile, cont->BinaryDir) ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: " - << sourceFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " produced b: " << sourceFile << std::endl, this->Quiet); *cont->OFS << " produced in binary dir: " << sourceFile << std::endl; actualSourceFile @@ -1387,19 +1398,19 @@ int cmCTestCoverageHandler::HandleGCovCoverage( { if ( missingFiles.find(sourceFile) == missingFiles.end() ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Something went wrong" << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Something went wrong" << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Cannot find file: [" - << sourceFile << "]" << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + << sourceFile << "]" << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in source dir: [" << cont->SourceDir << "]" - << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " or binary dir: [" << cont->BinaryDir.size() << "]" - << std::endl); + << std::endl, this->Quiet); *cont->OFS << " Something went wrong. Cannot find file: " << sourceFile << " in source dir: " << cont->SourceDir @@ -1415,9 +1426,10 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if ( file_count % 50 == 0 ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count - << " out of " << files.size() << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " processed: " + << file_count + << " out of " << files.size() << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); } } @@ -1435,22 +1447,22 @@ int cmCTestCoverageHandler::HandleLCovCoverage( = this->CTest->GetCTestConfiguration("CoverageExtraFlags"); if ( lcovCommand != "codecov" ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Not a valid Intel Coverage command." - << std::endl); + << std::endl, this->Quiet); return 0; } // There is only percentage completed output from LCOV std::string st2lcovOutputRex3 = "[0-9]+%"; cmsys::RegularExpression st2re3(st2lcovOutputRex3.c_str()); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " This is coverage command: " << lcovCommand - << std::endl); + << std::endl, this->Quiet); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " These are coverage command flags: " << lcovExtraFlags - << std::endl); + << std::endl, this->Quiet); std::vector<std::string> files; this->FindLCovFiles(files); @@ -1458,9 +1470,9 @@ int cmCTestCoverageHandler::HandleLCovCoverage( if (files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any LCov coverage files." - << std::endl); + << std::endl, this->Quiet); // No coverage files is a valid thing, so the exit code is 0 return 0; } @@ -1471,9 +1483,10 @@ int cmCTestCoverageHandler::HandleLCovCoverage( std::set<std::string> missingFiles; std::string actualSourceFile = ""; - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Processing coverage (each . represents one file):" << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Processing coverage (each . represents one file):" << std::endl, + this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); int file_count = 0; // make sure output from lcov is in English! @@ -1484,16 +1497,17 @@ int cmCTestCoverageHandler::HandleLCovCoverage( // directory. It collects all *.dyn files to generate .dpi file. for ( it = files.begin(); it != files.end(); ++ it ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, + this->Quiet); std::string fileDir = cmSystemTools::GetFilenamePath(*it); cmSystemTools::ChangeDirectory(fileDir); std::string command = "\"" + lcovCommand + "\" " + lcovExtraFlags + " "; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Current coverage dir: " - << fileDir << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Current coverage dir: " << fileDir << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() + << std::endl, this->Quiet); std::string output = ""; std::string errors = ""; @@ -1521,12 +1535,12 @@ int cmCTestCoverageHandler::HandleLCovCoverage( cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << cont->Error << std::endl); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "--------------------------------------------------------------" << std::endl << output << std::endl << "--------------------------------------------------------------" - << std::endl); + << std::endl, this->Quiet); std::vector<std::string> lines; std::vector<std::string>::iterator line; @@ -1554,8 +1568,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage( std::string daGlob; daGlob = dir; daGlob += "/*.LCOV"; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " looking for LCOV files in: " << daGlob << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " looking for LCOV files in: " << daGlob << std::endl, this->Quiet); gl.FindFiles(daGlob); // Keep a list of all LCOV files lcovFiles.insert(lcovFiles.end(), gl.GetFiles().begin(), @@ -1590,13 +1604,13 @@ int cmCTestCoverageHandler::HandleLCovCoverage( for(std::vector<std::string>::iterator t = lcovFiles.begin(); t != lcovFiles.end(); ++t) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found LCOV File: " - << *t << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found LCOV File: " << *t << std::endl, this->Quiet); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SourceFile: " - << sourceFile << std::endl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "lCovFile: " - << lcovFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SourceFile: " + << sourceFile << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "lCovFile: " + << lcovFile << std::endl, this->Quiet); // If we have some LCOV files to process if ( !lcovFile.empty() && !actualSourceFile.empty() ) @@ -1604,8 +1618,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage( cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec = cont->TotalCoverage[actualSourceFile]; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in lcovFile: " - << lcovFile << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " in lcovFile: " << lcovFile << std::endl, this->Quiet); cmsys::ifstream ifile(lcovFile.c_str()); if ( ! ifile ) @@ -1620,8 +1634,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage( // Skip the first line cmSystemTools::GetLineFromStream(ifile, nl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "File is ready, start reading." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "File is ready, start reading." << std::endl, this->Quiet); while ( cmSystemTools::GetLineFromStream(ifile, nl) ) { cnt ++; @@ -1679,9 +1693,10 @@ int cmCTestCoverageHandler::HandleLCovCoverage( if ( file_count % 50 == 0 ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count - << " out of " << files.size() << std::endl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " processed: " << file_count << " out of " << files.size() + << std::endl, this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); } } @@ -1707,8 +1722,8 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector<std::string>& files) // Coverage files appear next to their object files in the target // support directory. - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " globbing for coverage in: " << lmi->first << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " globbing for coverage in: " << lmi->first << std::endl, this->Quiet); std::string daGlob = lmi->first; daGlob += "/*.da"; gl.FindFiles(daGlob); @@ -1740,12 +1755,12 @@ void cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files) std::string daGlob; daGlob = prevBinaryDir; daGlob += "/*.dpi"; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " looking for dpi files in: " << daGlob << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " looking for dpi files in: " << daGlob << std::endl, this->Quiet); gl.FindFiles(daGlob); files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end()); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Now searching in: " << daGlob << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Now searching in: " << daGlob << std::endl, this->Quiet); } //---------------------------------------------------------------------- @@ -1761,9 +1776,9 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( if (files.empty()) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any Python Trace.py coverage files." - << std::endl); + << std::endl, this->Quiet); // No coverage files is a valid thing, so the exit code is 0 return 0; } @@ -1791,13 +1806,13 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( std::string actualSourceFile = cmSystemTools::CollapseFullPath(fileName); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Check coverage for file: " << actualSourceFile - << std::endl); + << std::endl, this->Quiet); cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec = &cont->TotalCoverage[actualSourceFile]; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " in file: " << *fileIt << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " in file: " << *fileIt << std::endl, this->Quiet); cmsys::ifstream ifile(fileIt->c_str()); if ( ! ifile ) { @@ -1850,9 +1865,9 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( // So, this will be set to 0. cov = 0; } - cmCTestLog(this->CTest, DEBUG, "Prefix: " << prefix + cmCTestOptionalLog(this->CTest, DEBUG, "Prefix: " << prefix << " cov: " << cov - << std::endl); + << std::endl, this->Quiet); // Read the line number starting at the 10th character of the gcov // output line long lineIdx = cnt; @@ -1945,18 +1960,16 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( // for each file run covbr on that file to get the coverage // information for that file std::string outputFile; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "run covbr: " - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "run covbr: " << std::endl, this->Quiet); if(!this->RunBullseyeCommand(cont, "covbr", 0, outputFile)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for." << "\n"); return -1; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "covbr output in " << outputFile - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "covbr output in " << outputFile << std::endl, this->Quiet); // open the output file cmsys::ifstream fin(outputFile.c_str()); if(!fin) @@ -2002,10 +2015,8 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( // only allow 100 files in each log file if ( count != 0 && count % 100 == 0 ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "start a new log file: " - << count - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "start a new log file: " << count << std::endl, this->Quiet); this->EndCoverageLogFile(covLogFile, logFileCount); logFileCount ++; if ( !this->StartCoverageLogFile(covLogFile, logFileCount) ) @@ -2021,10 +2032,9 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( { // we have a new file so count it in the output count++; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Produce coverage for file: " - << file << " " << count - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Produce coverage for file: " << file << " " << count + << std::endl, this->Quiet); // start the file output covLogFile << "\t<File Name=\"" << cmXMLSafe(i->first) @@ -2083,13 +2093,13 @@ int cmCTestCoverageHandler::RunBullseyeCommand( } if(arg) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Run : " << program << " " << arg << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Run : " << program << " " << arg << "\n", this->Quiet); } else { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Run : " << program << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Run : " << program << "\n", this->Quiet); } // create a process object and start it cmCTestRunProcess runCoverageSrc; @@ -2215,17 +2225,17 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( cont->BinaryDir.c_str()); if ( !shouldIDoCoverage ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - ".NoDartCoverage found, so skip coverage check for: " - << file - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + ".NoDartCoverage found, so skip coverage check for: " + << file + << std::endl, this->Quiet); continue; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Doing coverage for: " - << file - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Doing coverage for: " + << file + << std::endl, this->Quiet); coveredFiles.push_back(sourceFile); coveredFilesFullPath.push_back(file); @@ -2328,23 +2338,23 @@ int cmCTestCoverageHandler::HandleBullseyeCoverage( const char* covfile = cmSystemTools::GetEnv("COVFILE"); if(!covfile || strlen(covfile) == 0) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " COVFILE environment variable not found, not running " - " bullseye\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " COVFILE environment variable not found, not running " + " bullseye\n", this->Quiet); return 0; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " run covsrc with COVFILE=[" - << covfile - << "]" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " run covsrc with COVFILE=[" + << covfile + << "]" << std::endl, this->Quiet); if(!this->RunBullseyeSourceSummary(cont)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error running bullseye summary.\n"); return 0; } - cmCTestLog(this->CTest, DEBUG, "HandleBullseyeCoverage return 1 " - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "HandleBullseyeCoverage return 1 " + << std::endl, this->Quiet); return 1; } @@ -2438,8 +2448,8 @@ void cmCTestCoverageHandler::LoadLabels() std::string fileList = this->CTest->GetBinaryDir(); fileList += cmake::GetCMakeFilesDirectory(); fileList += "/TargetDirectories.txt"; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " target directory list [" << fileList << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " target directory list [" << fileList << "]\n", this->Quiet); cmsys::ifstream finList(fileList.c_str()); std::string line; while(cmSystemTools::GetLineFromStream(finList, line)) @@ -2460,8 +2470,8 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir) return; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " loading labels from [" << fname << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " loading labels from [" << fname << "]\n", this->Quiet); bool inTarget = true; std::string source; std::string line; diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 4aec795..3258ddb 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -30,9 +30,10 @@ public: typedef std::map<std::string, SingleFileCoverageVector> TotalCoverageMap; TotalCoverageMap TotalCoverage; std::ostream* OFS; + bool Quiet; }; /** \class cmCTestCoverageHandler - * \brief A class that handles coverage computaiton for ctest + * \brief A class that handles coverage computation for ctest * */ class cmCTestCoverageHandler : public cmCTestGenericHandler diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 13c8ca5..81eb0a8 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -22,6 +22,7 @@ cmCTestGenericHandler::cmCTestGenericHandler() this->CTest = 0; this->SubmitIndex = 0; this->AppendXML = false; + this->Quiet = false; } //---------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 2788cba..8567dd7 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -87,6 +87,8 @@ public: int GetSubmitIndex() { return this->SubmitIndex; } void SetAppendXML(bool b) { this->AppendXML = b; } + void SetQuiet(bool b) { this->Quiet = b; } + bool GetQuiet() { return this->Quiet; } protected: bool StartResultingXML(cmCTest::Part part, @@ -94,6 +96,7 @@ protected: bool StartLogFile(const char* name, cmGeneratedFileStream& xofs); bool AppendXML; + bool Quiet; cmSystemTools::OutputOption HandlerVerbose; cmCTest *CTest; t_StringToString Options; diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index b886777..3003e8a 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -29,6 +29,7 @@ cmCTestHandlerCommand::cmCTestHandlerCommand() this->Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX"; this->Last = ct_LAST; this->AppendXML = false; + this->Quiet = false; } bool cmCTestHandlerCommand @@ -74,7 +75,7 @@ bool cmCTestHandlerCommand { this->CTest->SetCTestConfiguration("BuildDirectory", cmSystemTools::CollapseFullPath( - this->Values[ct_BUILD]).c_str()); + this->Values[ct_BUILD]).c_str(), this->Quiet); } else { @@ -84,7 +85,7 @@ bool cmCTestHandlerCommand { this-> CTest->SetCTestConfiguration("BuildDirectory", - cmSystemTools::CollapseFullPath(bdir).c_str()); + cmSystemTools::CollapseFullPath(bdir).c_str(), this->Quiet); } else { @@ -98,13 +99,14 @@ bool cmCTestHandlerCommand "Set source directory to: " << this->Values[ct_SOURCE] << std::endl); this->CTest->SetCTestConfiguration("SourceDirectory", cmSystemTools::CollapseFullPath( - this->Values[ct_SOURCE]).c_str()); + this->Values[ct_SOURCE]).c_str(), this->Quiet); } else { this->CTest->SetCTestConfiguration("SourceDirectory", cmSystemTools::CollapseFullPath( - this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str()); + this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str(), + this->Quiet); } cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;); @@ -160,6 +162,12 @@ bool cmCTestHandlerCommand::CheckArgumentKeyword(std::string const& arg) this->AppendXML = true; return true; } + if(arg == "QUIET") + { + this->ArgumentDoing = ArgumentDoingNone; + this->Quiet = true; + return true; + } // Check for a keyword in our argument/value table. for(unsigned int k=0; k < this->Arguments.size(); ++k) diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index 8ef2b80..87b2cd8 100644 --- a/Source/CTest/cmCTestHandlerCommand.h +++ b/Source/CTest/cmCTestHandlerCommand.h @@ -62,6 +62,7 @@ protected: unsigned int ArgumentIndex; bool AppendXML; + bool Quiet; std::string ReturnVariable; std::vector<const char*> Arguments; 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/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index f223127..eb33d8e 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -113,7 +113,8 @@ void cmCTestMultiProcessHandler::RunTests() //--------------------------------------------------------- void cmCTestMultiProcessHandler::StartTestProcess(int test) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "test " << test << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "test " << test << "\n", this->Quiet); this->TestRunningMap[test] = true; // mark the test as running // now remove the test itself this->EraseTest(test); @@ -639,39 +640,44 @@ void cmCTestMultiProcessHandler::PrintTestList() if(!p.Labels.empty()) //print the labels { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:", + this->Quiet); } for(std::vector<std::string>::iterator label = p.Labels.begin(); label != p.Labels.end(); ++label) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label, + this->Quiet); } if(!p.Labels.empty()) //print the labels { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl, + this->Quiet); } if (this->TestHandler->MemCheck) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Memory Check"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Memory Check", + this->Quiet); } else { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Test"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Test", this->Quiet); } std::ostringstream indexStr; indexStr << " #" << p.Index << ":"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex())) - << indexStr.str()); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); - cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl); + << indexStr.str(), this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + p.Name.c_str() << std::endl, this->Quiet); //pop working dir cmSystemTools::ChangeDirectory(current_dir); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: " - << this->Total << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: " + << this->Total << std::endl, this->Quiet); } void cmCTestMultiProcessHandler::PrintLabels() @@ -686,16 +692,19 @@ void cmCTestMultiProcessHandler::PrintLabels() if(!allLabels.empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "All Labels:" << std::endl, this->Quiet); } else { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "No Labels Exist" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "No Labels Exist" << std::endl, this->Quiet); } for(std::set<std::string>::iterator label = allLabels.begin(); label != allLabels.end(); ++label) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << *label << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " " << *label << std::endl, this->Quiet); } } @@ -758,8 +767,8 @@ int cmCTestMultiProcessHandler::FindMaxIndex() //Returns true if no cycles exist in the dependency graph bool cmCTestMultiProcessHandler::CheckCycles() { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Checking test dependency graph..." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph..." << std::endl, this->Quiet); for(TestMap::iterator it = this->Tests.begin(); it != this->Tests.end(); ++it) { @@ -794,7 +803,7 @@ bool cmCTestMultiProcessHandler::CheckCycles() } } } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Checking test dependency graph end" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph end" << std::endl, this->Quiet); return true; } diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 605de31..6440fbc 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -57,6 +57,8 @@ public: cmCTestTestHandler * GetTestHandler() { return this->TestHandler; } + + void SetQuiet(bool b) { this->Quiet = b; } protected: // Start the next test or tests as many as are allowed by // ParallelLevel @@ -118,6 +120,7 @@ protected: cmCTestTestHandler * TestHandler; cmCTest* CTest; bool HasCycles; + bool Quiet; }; #endif 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/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 8ea6cef..e19e4f4 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -20,6 +20,7 @@ cmCTestStartCommand::cmCTestStartCommand() { this->CreateNewTag = true; + this->Quiet = false; } bool cmCTestStartCommand @@ -57,6 +58,14 @@ bool cmCTestStartCommand this->CreateNewTag = false; } } + if (cnt < args.size()) + { + if (args[cnt] == "QUIET") + { + cnt ++; + this->Quiet = true; + } + } if ( cnt < args.size() ) { @@ -95,18 +104,20 @@ bool cmCTestStartCommand std::string sourceDir = cmSystemTools::CollapseFullPath(src_dir); std::string binaryDir = cmSystemTools::CollapseFullPath(bld_dir); - this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str()); - this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str()); + this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str(), + this->Quiet); + this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str(), + this->Quiet); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model " << smodel << std::endl << " Source directory: " << src_dir << std::endl - << " Build directory: " << bld_dir << std::endl); + << " Build directory: " << bld_dir << std::endl, this->Quiet); const char* track = this->CTest->GetSpecificTrack(); if ( track ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Track: " << track << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Track: " << track << std::endl, this->Quiet); } // Log startup actions. diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 3b8843f..eed1962 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -34,6 +34,7 @@ public: ni->CTest = this->CTest; ni->CTestScriptHandler = this->CTestScriptHandler; ni->CreateNewTag = this->CreateNewTag; + ni->Quiet = this->Quiet; return ni; } @@ -53,6 +54,14 @@ public: } /** + * Should this invocation of ctest_start output non-error messages? + */ + bool ShouldBeQuiet() + { + return this->Quiet; + } + + /** * The name of the command as specified in CMakeList.txt. */ virtual std::string GetName() const { return "ctest_start";} @@ -62,6 +71,7 @@ public: private: bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir); bool CreateNewTag; + bool Quiet; }; diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index cc3514f..5a8090c 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -44,29 +44,33 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() // error: CDash requires CTEST_DROP_LOCATION definition // in CTestConfig.cmake } - this->CTest->SetCTestConfiguration("ProjectName", ctestProjectName); - this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod); - this->CTest->SetCTestConfiguration("DropSite", ctestDropSite); - this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation); + this->CTest->SetCTestConfiguration("ProjectName", ctestProjectName, + this->Quiet); + this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod, + this->Quiet); + this->CTest->SetCTestConfiguration("DropSite", ctestDropSite, this->Quiet); + this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation, + this->Quiet); this->CTest->SetCTestConfiguration("IsCDash", - ctestDropSiteCDash ? "TRUE" : "FALSE"); + ctestDropSiteCDash ? "TRUE" : "FALSE", this->Quiet); // Only propagate TriggerSite for non-CDash projects: // if ( !ctestDropSiteCDash ) { - this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite); + this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite, + this->Quiet); } this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CurlOptions", "CTEST_CURL_OPTIONS"); + "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "DropSiteUser", "CTEST_DROP_SITE_USER"); + "DropSiteUser", "CTEST_DROP_SITE_USER", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "DropSitePassword", "CTEST_DROP_SITE_PASSWORD"); + "DropSitePassword", "CTEST_DROP_SITE_PASSWORD", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "ScpCommand", "CTEST_SCP_COMMAND"); + "ScpCommand", "CTEST_SCP_COMMAND", this->Quiet); const char* notesFilesVariable = this->Makefile->GetDefinition("CTEST_NOTES_FILES"); @@ -145,6 +149,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() static_cast<cmCTestSubmitHandler*>(handler)->SetOption("InternalTest", this->InternalTest ? "ON" : "OFF"); + handler->SetQuiet(this->Quiet); + if (this->CDashUpload) { static_cast<cmCTestSubmitHandler*>(handler)-> diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 5b52df7..d585863 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -242,9 +242,9 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); *this->LogFile << "\tUpload file: " << local_file << " to " << upload_as << std::endl; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " - << local_file << " to " - << upload_as << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Upload file: " << local_file << " to " << upload_as << std::endl, + this->Quiet); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); @@ -278,15 +278,15 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, if (!chunk.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl); + << std::endl, this->Quiet); } if (!chunkDebug.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" - << std::endl); + << std::endl, this->Quiet); } fclose(ftpfile); @@ -318,8 +318,8 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, } // always cleanup ::curl_easy_cleanup(curl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Uploaded: " + local_file - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Uploaded: " + local_file << std::endl, this->Quiet); } } ::curl_global_cleanup(); @@ -369,14 +369,14 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, cmCurlSetCAInfo(curl); if(verifyPeerOff) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Set CURLOPT_SSL_VERIFYPEER to off\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Set CURLOPT_SSL_VERIFYPEER to off\n", this->Quiet); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); } if(verifyHostOff) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Set CURLOPT_SSL_VERIFYHOST to off\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Set CURLOPT_SSL_VERIFYHOST to off\n", this->Quiet); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); } @@ -482,9 +482,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, unsigned long filelen = cmSystemTools::FileLength(local_file); ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " - << local_file << " to " - << upload_as << " Size: " << filelen << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Upload file: " << local_file << " to " + << upload_as << " Size: " << filelen << std::endl, this->Quiet); // specify target ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); @@ -529,16 +529,16 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, if (!chunk.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl); + << std::endl, this->Quiet); this->ParseResponse(chunk); } if (!chunkDebug.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" - << std::endl); + << std::endl, this->Quiet); } // If curl failed for any reason, or checksum fails, wait and retry @@ -557,8 +557,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, for(int i = 0; i < count; i++) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Submit failed, waiting " << delay << " seconds...\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Submit failed, waiting " << delay << " seconds...\n", + this->Quiet); double stop = cmSystemTools::GetTime() + delay; while(cmSystemTools::GetTime() < stop) @@ -566,9 +567,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, cmSystemTools::Delay(100); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Retry submission: Attempt " << (i + 1) << " of " - << count << std::endl); + << count << std::endl, this->Quiet); ::fclose(ftpfile); ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); @@ -582,9 +583,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, if (!chunk.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl); + << std::endl, this->Quiet); this->ParseResponse(chunk); } @@ -624,8 +625,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, } // always cleanup ::curl_easy_cleanup(curl); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Uploaded: " + local_file - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Uploaded: " + local_file << std::endl, this->Quiet); } } ::curl_global_cleanup(); @@ -677,6 +678,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( { CURL *curl; char error_buffer[1024]; + /* In windows, this will init the winsock stuff */ ::curl_global_init(CURL_GLOBAL_ALL); @@ -756,8 +758,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( = url + ((url.find("?",0) == std::string::npos) ? "?" : "&") + "xmlfile=" + ofile; *this->LogFile << "Trigger url: " << turl << std::endl; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " - << turl << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Trigger url: " << turl << std::endl, this->Quiet); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(curl, CURLOPT_URL, turl.c_str()); if ( curl_easy_perform(curl) ) @@ -786,25 +788,26 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( if (!chunk.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl); + << std::endl, this->Quiet); } if (!chunkDebug.empty()) { - cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" + cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) - << "]" << std::endl); + << "]" << std::endl, this->Quiet); } // always cleanup ::curl_easy_cleanup(curl); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl, + this->Quiet); } } ::curl_global_cleanup(); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Dart server triggered..." - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Dart server triggered..." + << std::endl, this->Quiet); return true; } @@ -821,6 +824,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( { return 0; } + std::vector<const char*> argv; argv.push_back(scp_command.c_str()); // Scp command argv.push_back(scp_command.c_str()); // Dummy string for file @@ -845,9 +849,9 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( argv[1] = lfname.c_str(); std::string rfname = url + "/" + remoteprefix + *file; argv[2] = rfname.c_str(); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Execute \"" << argv[0] - << "\" \"" << argv[1] << "\" \"" - << argv[2] << "\"" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" + << argv[2] << "\"" << std::endl, this->Quiet); *this->LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" << argv[2] << "\"" << std::endl; @@ -858,8 +862,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( while(cmsysProcess_WaitForData(cp, &data, &length, 0)) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - cmCTestLogWrite(data, length)); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestLogWrite(data, length), this->Quiet); } cmsysProcess_WaitForExit(cp, 0); @@ -871,8 +875,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( retVal = cmsysProcess_GetExitValue(cp); if ( retVal != 0 ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\tSCP returned: " - << retVal << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "\tSCP returned: " << retVal << std::endl, this->Quiet); *this->LogFile << "\tSCP returned: " << retVal << std::endl; problems ++; } @@ -927,6 +931,7 @@ bool cmCTestSubmitHandler::SubmitUsingCP( << "\tdestination: " << destination << std::endl); return 0; } + cmCTest::SetOfStrings::const_iterator file; bool problems = false; for ( file = files.begin(); file != files.end(); ++file ) @@ -936,9 +941,9 @@ bool cmCTestSubmitHandler::SubmitUsingCP( lfname += "/" + *file; std::string rfname = destination + "/" + remoteprefix + *file; cmSystemTools::CopyFileAlways(lfname, rfname); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " << lfname << " to " - << rfname << std::endl); + << rfname << std::endl, this->Quiet); } std::string tagDoneFile = destination + "/" + remoteprefix + "DONE"; cmSystemTools::Touch(tagDoneFile, true); @@ -971,8 +976,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix, xmlrpc_env_init(&env); /* Call the famous server at UserLand. */ - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submitting to: " - << realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submitting to: " + << realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl, + this->Quiet); cmCTest::SetOfStrings::const_iterator file; for ( file = files.begin(); file != files.end(); ++file ) { @@ -983,8 +989,8 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix, { local_file = localprefix + "/" + *file; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submit file: " - << local_file.c_str() << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submit file: " + << local_file.c_str() << std::endl, this->Quiet); struct stat st; if ( ::stat(local_file.c_str(), &st) ) { @@ -1068,12 +1074,14 @@ void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod, if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 ) { url += this->CTest->GetCTestConfiguration("DropSiteUser"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, - this->CTest->GetCTestConfiguration("DropSiteUser").c_str()); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), + this->Quiet); if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 ) { url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", + this->Quiet); } url += "@"; } @@ -1147,8 +1155,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, << "datafilesmd5[0]=" << md5sum << "&" << "type=" << curl.Escape(typeString); std::string fields = str.str(); - cmCTestLog(this->CTest, DEBUG, "fields: " << fields << "\nurl:" - << url << "\nfile: " << file << "\n"); + cmCTestOptionalLog(this->CTest, DEBUG, "fields: " << fields << "\nurl:" + << url << "\nfile: " << file << "\n", this->Quiet); std::string response; if(!curl.HttpRequest(url, fields, response)) { @@ -1156,8 +1164,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, "Error in HttpRequest\n" << response); return -1; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Request upload response: [" << response << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Request upload response: [" << response << "]\n", this->Quiet); Json::Value json; Json::Reader reader; if(!reader.parse(response, json)) @@ -1179,9 +1187,9 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, int datares = json["datafilesmd5"][0].asInt(); if(datares == 1) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "File already exists on CDash, skip upload " - << file << "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "File already exists on CDash, skip upload " << file << "\n", + this->Quiet); return 0; } } @@ -1213,8 +1221,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, << reader.getFormattedErrorMessages() << "\n"); return -1; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Upload file response: [" << response << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Upload file response: [" << response << "]\n", this->Quiet ); return 0; } @@ -1311,13 +1319,13 @@ int cmCTestSubmitHandler::ProcessHandler() if (!this->HTTPProxy.empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " - << this->HTTPProxy << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " + << this->HTTPProxy << std::endl, this->Quiet); } if (!this->FTPProxy.empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: " - << this->FTPProxy << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: " + << this->FTPProxy << std::endl, this->Quiet); } cmGeneratedFileStream ofs; this->StartLogFile("Submit", ofs); @@ -1349,16 +1357,16 @@ int cmCTestSubmitHandler::ProcessHandler() = buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(); std::string::size_type glen = gpath.size() + 1; gpath = gpath + "/CoverageLog*"; - cmCTestLog(this->CTest, DEBUG, "Globbing for: " << gpath - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Globbing for: " << gpath + << std::endl, this->Quiet); if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) ) { size_t cc; for ( cc = 0; cc < gfiles.size(); cc ++ ) { gfiles[cc] = gfiles[cc].substr(glen); - cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc] - << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc] + << std::endl, this->Quiet); this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfiles[cc].c_str()); } } @@ -1398,14 +1406,14 @@ int cmCTestSubmitHandler::ProcessHandler() cnt ++; } } - cmCTestLog(this->CTest, HANDLER_OUTPUT, "Submit files (using " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Submit files (using " << this->CTest->GetCTestConfiguration("DropMethod") << ")" - << std::endl); + << std::endl, this->Quiet); const char* specificTrack = this->CTest->GetSpecificTrack(); if ( specificTrack ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Send to track: " - << specificTrack << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Send to track: " + << specificTrack << std::endl, this->Quiet); } this->SetLogFile(&ofs); @@ -1414,9 +1422,9 @@ int cmCTestSubmitHandler::ProcessHandler() if ( dropMethod == "" || dropMethod == "ftp" ) { ofs << "Using drop method: FTP" << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using FTP submit method" - << std::endl - << " Drop site: ftp://"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using FTP submit method" << std::endl << " Drop site: ftp://", + this->Quiet); std::string url = "ftp://"; url += cmCTest::MakeURLSafe( this->CTest->GetCTestConfiguration("DropSiteUser")) + ":" + @@ -1427,18 +1435,20 @@ int cmCTestSubmitHandler::ProcessHandler() this->CTest->GetCTestConfiguration("DropLocation")); if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration( - "DropSiteUser").c_str()); + "DropSiteUser").c_str(), this->Quiet); if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", + this->Quiet); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, "@"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "@", this->Quiet); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration("DropSite") - << this->CTest->GetCTestConfiguration("DropLocation") << std::endl); + << this->CTest->GetCTestConfiguration("DropLocation") << std::endl, + this->Quiet); if ( !this->SubmitUsingFTP(buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(), files, prefix, url) ) @@ -1451,11 +1461,12 @@ int cmCTestSubmitHandler::ProcessHandler() } if(!this->CDash) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using HTTP trigger method" << std::endl << " Trigger site: " << this->CTest->GetCTestConfiguration("TriggerSite") - << std::endl); + << std::endl, this->Quiet); if ( !this-> TriggerUsingHTTP(files, prefix, this->CTest->GetCTestConfiguration("TriggerSite"))) @@ -1465,8 +1476,8 @@ int cmCTestSubmitHandler::ProcessHandler() ofs << " Problems when triggering via HTTP" << std::endl; return -1; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Submission successful" << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; return 0; } @@ -1476,27 +1487,30 @@ int cmCTestSubmitHandler::ProcessHandler() std::string url = dropMethod; url += "://"; ofs << "Using drop method: " << dropMethod << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method" - << std::endl - << " Drop site:" << url); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using HTTP submit method" << std::endl << " Drop site:" << url, + this->Quiet); if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { url += this->CTest->GetCTestConfiguration("DropSiteUser"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, - this->CTest->GetCTestConfiguration("DropSiteUser").c_str()); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), + this->Quiet); if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", + this->Quiet); } url += "@"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "@"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "@", this->Quiet); } url += this->CTest->GetCTestConfiguration("DropSite") + this->CTest->GetCTestConfiguration("DropLocation"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration("DropSite") - << this->CTest->GetCTestConfiguration("DropLocation") << std::endl); + << this->CTest->GetCTestConfiguration("DropLocation") << std::endl, + this->Quiet); if ( !this->SubmitUsingHTTP(buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(), files, prefix, url) ) { @@ -1507,11 +1521,10 @@ int cmCTestSubmitHandler::ProcessHandler() } if(!this->CDash) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" - << std::endl - << " Trigger site: " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using HTTP trigger method" << std::endl << " Trigger site: " << this->CTest->GetCTestConfiguration("TriggerSite") - << std::endl); + << std::endl, this->Quiet); if ( !this-> TriggerUsingHTTP(files, prefix, this->CTest->GetCTestConfiguration("TriggerSite"))) @@ -1530,8 +1543,10 @@ int cmCTestSubmitHandler::ProcessHandler() } else { - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << - (this->HasWarnings ? ", with warnings." : "") << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Submission successful" << + (this->HasWarnings ? ", with warnings." : "") << std::endl, + this->Quiet); ofs << " Submission successful" << (this->HasWarnings ? ", with warnings." : "") << std::endl; } @@ -1542,8 +1557,8 @@ int cmCTestSubmitHandler::ProcessHandler() { #if defined(CTEST_USE_XMLRPC) ofs << "Using drop method: XML-RPC" << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using XML-RPC submit method" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Using XML-RPC submit method" << std::endl, this->Quiet); std::string url = this->CTest->GetCTestConfiguration("DropSite"); prefix = this->CTest->GetCTestConfiguration("DropLocation"); if ( !this->SubmitUsingXMLRPC(buildDirectory + "/Testing/" + @@ -1554,8 +1569,8 @@ int cmCTestSubmitHandler::ProcessHandler() ofs << " Problems when submitting via XML-RPC" << std::endl; return -1; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful" + << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; return 0; #else @@ -1593,8 +1608,8 @@ int cmCTestSubmitHandler::ProcessHandler() return -1; } cmSystemTools::ChangeDirectory(oldWorkingDirectory); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful" + << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; return 0; } @@ -1609,8 +1624,8 @@ int cmCTestSubmitHandler::ProcessHandler() std::string oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(buildDirectory); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " - << buildDirectory << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Change directory: " << buildDirectory << std::endl, this->Quiet); if ( !this->SubmitUsingCP( "Testing/"+this->CTest->GetCurrentTag(), @@ -1626,8 +1641,8 @@ int cmCTestSubmitHandler::ProcessHandler() return -1; } cmSystemTools::ChangeDirectory(oldWorkingDirectory); - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful" + << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; return 0; } diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index d209094..8b357ac 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -103,6 +103,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() { this->CTest->SetStopTime(this->Values[ctt_STOP_TIME]); } + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 925e3c9..0e84fbf 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -527,10 +527,10 @@ int cmCTestTestHandler::ProcessHandler() this->TestResults.clear(); - cmCTestLog(this->CTest, HANDLER_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, (this->MemCheck ? "Memory check" : "Test") << " project " << cmSystemTools::GetCurrentWorkingDirectory() - << std::endl); + << std::endl, this->Quiet); if ( ! this->PreProcessHandler() ) { return -1; @@ -567,13 +567,13 @@ int cmCTestTestHandler::ProcessHandler() if (this->HandlerVerbose && !passed.empty() && (this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag)) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl - << "The following tests passed:" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl + << "The following tests passed:" << std::endl, this->Quiet); for(std::vector<std::string>::iterator j = passed.begin(); j != passed.end(); ++j) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j + << std::endl, this->Quiet); } } @@ -593,8 +593,8 @@ int cmCTestTestHandler::ProcessHandler() } char realBuf[1024]; sprintf(realBuf, "%6.2f sec", (double)(clock_finish - clock_start)); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " - << realBuf << "\n" ); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + "\nTotal Test time (real) = " << realBuf << "\n", this->Quiet ); if (!failed.empty()) { @@ -614,11 +614,11 @@ int cmCTestTestHandler::ProcessHandler() if ( ftit->Status != cmCTestTestHandler::COMPLETED ) { ofs << ftit->TestCount << ":" << ftit->Name << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) << ftit->TestCount << " - " << ftit->Name << " (" << this->GetTestStatus(ftit->Status) << ")" - << std::endl); + << std::endl, this->Quiet); } } } @@ -700,7 +700,8 @@ void cmCTestTestHandler::PrintLabelSummary() // now print times if(!labels.empty()) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:", + this->Quiet); } for(std::set<std::string>::const_iterator i = labels.begin(); i != labels.end(); ++i) @@ -709,8 +710,8 @@ void cmCTestTestHandler::PrintLabelSummary() label.resize(maxlen +3, ' '); char buf[1024]; sprintf(buf, "%6.2f sec", labelTimes[*i]); - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n" - << label << " = " << buf ); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n" + << label << " = " << buf, this->Quiet ); if ( this->LogFile ) { *this->LogFile << "\n" << *i << " = " @@ -723,7 +724,7 @@ void cmCTestTestHandler::PrintLabelSummary() { *this->LogFile << "\n"; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, "\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n", this->Quiet); } } @@ -1063,6 +1064,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed, parallel->SetCTest(this->CTest); parallel->SetParallelLevel(this->CTest->GetParallelLevel()); parallel->SetTestHandler(this); + parallel->SetQuiet(this->Quiet); *this->LogFile << "Start testing: " << this->CTest->CurrentTime() << std::endl @@ -1334,8 +1336,8 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec) for ( it = vec.begin(); it != vec.end(); ++it ) { int retVal = 0; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it - << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << + *it << std::endl, this->Quiet); if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0, cmSystemTools::OUTPUT_MERGE /*this->Verbose*/) || retVal != 0 ) @@ -1541,8 +1543,7 @@ std::string cmCTestTestHandler for(std::vector<std::string>::iterator i = failed.begin(); i != failed.end(); ++i) { - cmCTestLog(ctest, HANDLER_OUTPUT, - i->c_str() << "\n"); + cmCTestLog(ctest, HANDLER_OUTPUT, i->c_str() << "\n"); } } @@ -1571,8 +1572,8 @@ void cmCTestTestHandler::GetListOfTests() { this->ExcludeTestsRegularExpression.compile(this->ExcludeRegExp.c_str()); } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Constructing a list of tests" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Constructing a list of tests" << std::endl, this->Quiet); cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); @@ -1628,8 +1629,8 @@ void cmCTestTestHandler::GetListOfTests() { return; } - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Done constructing a list of tests" << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Done constructing a list of tests" << std::endl, this->Quiet); } //---------------------------------------------------------------------- @@ -2016,8 +2017,8 @@ std::string cmCTestTestHandler::GenerateRegressionImages( << "><Value>File " << filename << " not found</Value></NamedMeasurement>" << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename - << "\" not found." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename + << "\" not found." << std::endl, this->Quiet); } cxml.erase(measurementfile.start(), measurementfile.end() - measurementfile.start()); @@ -2265,7 +2266,8 @@ bool cmCTestTestHandler::SetTestsProperties( bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) { const std::string& testname = args[0]; - cmCTestLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl, + this->Quiet); if (this->UseExcludeRegExpFlag && this->UseExcludeRegExpFirst && @@ -2288,8 +2290,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) } if ( found ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore memcheck: " - << *it << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Ignore memcheck: " << *it << std::endl, this->Quiet); return true; } } @@ -2308,8 +2310,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) } if ( found ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: " - << *it << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Ignore test: " + << *it << std::endl, this->Quiet); return true; } } @@ -2318,8 +2320,8 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) test.Name = testname; test.Args = args; test.Directory = cmSystemTools::GetCurrentWorkingDirectory(); - cmCTestLog(this->CTest, DEBUG, "Set test directory: " - << test.Directory << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Set test directory: " + << test.Directory << std::endl, this->Quiet); test.IsInBasedOnREOptions = true; test.WillFail = false; diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index f87466d..dfda9f1 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -20,55 +20,56 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() { this->CTest->SetCTestConfiguration("SourceDirectory", cmSystemTools::CollapseFullPath( - this->Values[ct_SOURCE]).c_str()); + this->Values[ct_SOURCE]).c_str(), this->Quiet); } else { this->CTest->SetCTestConfiguration("SourceDirectory", cmSystemTools::CollapseFullPath( - this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")).c_str()); + this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")).c_str(), + this->Quiet); } std::string source_dir = this->CTest->GetCTestConfiguration("SourceDirectory"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "UpdateCommand", "CTEST_UPDATE_COMMAND"); + "UpdateCommand", "CTEST_UPDATE_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "UpdateOptions", "CTEST_UPDATE_OPTIONS"); + "UpdateOptions", "CTEST_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CVSCommand", "CTEST_CVS_COMMAND"); + "CVSCommand", "CTEST_CVS_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS"); + "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "SVNCommand", "CTEST_SVN_COMMAND"); + "SVNCommand", "CTEST_SVN_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS"); + "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "SVNOptions", "CTEST_SVN_OPTIONS"); + "SVNOptions", "CTEST_SVN_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "BZRCommand", "CTEST_BZR_COMMAND"); + "BZRCommand", "CTEST_BZR_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS"); + "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "GITCommand", "CTEST_GIT_COMMAND"); + "GITCommand", "CTEST_GIT_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS"); + "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM"); + "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY"); + "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "HGCommand", "CTEST_HG_COMMAND"); + "HGCommand", "CTEST_HG_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS"); + "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "P4Command", "CTEST_P4_COMMAND"); + "P4Command", "CTEST_P4_COMMAND", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS"); + "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "P4Client", "CTEST_P4_CLIENT"); + "P4Client", "CTEST_P4_CLIENT", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, - "P4Options", "CTEST_P4_OPTIONS"); + "P4Options", "CTEST_P4_OPTIONS", this->Quiet); cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("update"); @@ -84,6 +85,7 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() return 0; } handler->SetOption("SourceDirectory", source_dir.c_str()); + handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 4c37c8b..b18786a 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -122,11 +122,13 @@ void cmCTestUpdateHandler::Initialize() //---------------------------------------------------------------------- int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) { - cmCTestLog(this->CTest, DEBUG, "Determine update type from command: " << cmd - << " and type: " << type << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Determine update type from command: " << cmd << " and type: " << type << + std::endl, this->Quiet); if ( type && *type ) { - cmCTestLog(this->CTest, DEBUG, "Type specified: " << type << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Type specified: " << type << + std::endl, this->Quiet); std::string stype = cmSystemTools::LowerCase(type); if ( stype.find("cvs") != std::string::npos ) { @@ -155,8 +157,8 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) } else { - cmCTestLog(this->CTest, DEBUG, "Type not specified, check command: " - << cmd << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, + "Type not specified, check command: " << cmd << std::endl, this->Quiet); std::string stype = cmSystemTools::LowerCase(cmd); if ( stype.find("cvs") != std::string::npos ) { @@ -211,18 +213,19 @@ int cmCTestUpdateHandler::ProcessHandler() this->StartLogFile("Update", ofs); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Updating the repository: " - << sourceDirectory << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Updating the repository: " << sourceDirectory << std::endl, + this->Quiet); if(!this->SelectVCS()) { return -1; } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use " + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Use " << cmCTestUpdateHandlerUpdateToString(this->UpdateType) << " repository type" - << std::endl;); + << std::endl;, this->Quiet); // Create an object to interact with the VCS tool. cmsys::auto_ptr<cmCTestVC> vc; @@ -283,23 +286,23 @@ int cmCTestUpdateHandler::ProcessHandler() int numUpdated = vc->GetPathCount(cmCTestVC::PathUpdated); if(numUpdated) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Found " << numUpdated << " updated files\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Found " << numUpdated << " updated files\n", this->Quiet); } if(int numModified = vc->GetPathCount(cmCTestVC::PathModified)) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Found " << numModified << " locally modified files\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Found " << numModified << " locally modified files\n", this->Quiet); localModifications += numModified; } if(int numConflicting = vc->GetPathCount(cmCTestVC::PathConflicting)) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Found " << numConflicting << " conflicting files\n"); + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Found " << numConflicting << " conflicting files\n", this->Quiet); localModifications += numConflicting; } - cmCTestLog(this->CTest, DEBUG, "End" << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet); std::string end_time = this->CTest->CurrentTime(); os << "\t<EndDateTime>" << end_time << "</EndDateTime>\n" << "\t<EndTime>" << static_cast<unsigned int>(cmSystemTools::GetTime()) @@ -331,8 +334,8 @@ int cmCTestUpdateHandler::ProcessHandler() int cmCTestUpdateHandler::DetectVCS(const char* dir) { std::string sourceDirectory = dir; - cmCTestLog(this->CTest, DEBUG, "Check directory: " - << sourceDirectory << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "Check directory: " + << sourceDirectory << std::endl, this->Quiet); sourceDirectory += "/.svn"; if ( cmSystemTools::FileExists(sourceDirectory.c_str()) ) { diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 5613751..f5000dd 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -26,6 +26,7 @@ cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler() } static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files); + handler->SetQuiet(this->Quiet); return handler; } @@ -38,6 +39,12 @@ bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg) this->ArgumentDoing = ArgumentDoingFiles; return true; } + if(arg == "QUIET") + { + this->ArgumentDoing = ArgumentDoingNone; + this->Quiet = true; + return true; + } return false; } diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx index e33c387..579190a 100644 --- a/Source/CTest/cmCTestUploadHandler.cxx +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -64,8 +64,8 @@ int cmCTestUploadHandler::ProcessHandler() for ( it = this->Files.begin(); it != this->Files.end(); it ++ ) { - cmCTestLog(this->CTest, OUTPUT, - "\tUpload file: " << *it << std::endl); + cmCTestOptionalLog(this->CTest, OUTPUT, + "\tUpload file: " << *it << std::endl, this->Quiet); ofs << "<File filename=\"" << cmXMLSafe(*it) << "\">\n" << "<Content encoding=\"base64\">\n"; ofs << this->CTest->Base64EncodeFile(*it); diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index 85d066b..1edd01f 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.cxx +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -138,12 +138,12 @@ bool cmParseBlanketJSCoverage::LoadCoverageData(std::vector<std::string> files) { size_t i=0; std::string path; - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Found " << files.size() <<" Files" << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Found " << files.size() <<" Files" << std::endl, this->Coverage.Quiet); for(i=0;i<files.size();i++) { - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Reading JSON File " << files[i] << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Reading JSON File " << files[i] << std::endl, this->Coverage.Quiet); if(!this->ReadJSONFile(files[i])) { @@ -157,8 +157,8 @@ bool cmParseBlanketJSCoverage::ReadJSONFile(std::string file) { cmParseBlanketJSCoverage::JSONParser parser (this->Coverage); - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Parsing " << file << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Parsing " << file << std::endl, this->Coverage.Quiet); parser.ParseFile(file); return true; } diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index 3642308..92bf88e 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -71,9 +71,9 @@ void cmParseCacheCoverage::RemoveUnCoveredFiles() } if(nothing) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "No coverage found in: " << ci->first - << std::endl); + << std::endl, this->Coverage.Quiet); this->Coverage.TotalCoverage.erase(ci++); } else diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index e19b199..3ed5cb0 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -50,8 +50,8 @@ protected: if (this->InSources && this->InSource) { this->FilePaths.push_back(tmp); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Adding Source: " - << tmp << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Adding Source: " << tmp << std::endl, this->Coverage.Quiet); } } @@ -74,8 +74,9 @@ protected: { if(strcmp(atts[tagCount], "filename") == 0) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: " - << atts[tagCount+1]<< std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Reading file: " << atts[tagCount+1]<< std::endl, + this->Coverage.Quiet); std::string filename = atts[tagCount+1]; this->CurFileName = ""; @@ -113,9 +114,9 @@ protected: fin.open(this->CurFileName.c_str()); if (!fin) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Skipping system file " << filename << - std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Skipping system file " << filename << std::endl, + this->Coverage.Quiet); this->SkipThisClass = true; break; diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index 4dfdfac..e453fe1 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -122,8 +122,9 @@ public: lastoffset = line.find('(',pos); if(lastoffset==line.npos) { - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - endnamepos << "File not found " << lastoffset << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + endnamepos << "File not found " << lastoffset << std::endl, + this->Coverage.Quiet); return false; } endnamepos = line.find(')',lastoffset); @@ -131,8 +132,9 @@ public: (endnamepos-1)-lastoffset); if(filename.find(".pas") != filename.npos) { - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Coverage found for file: " << filename << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Coverage found for file: " << filename << std::endl, + this->Coverage.Quiet); break; } pos = lastoffset+1; @@ -153,8 +155,9 @@ public: * If that doesn't find any matching files * return a failure. */ - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Unable to find file matching" << glob << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Unable to find file matching" << glob << std::endl, + this->Coverage.Quiet); return false; } FileLinesType& coverageVector = @@ -229,8 +232,8 @@ bool cmParseDelphiCoverage::LoadCoverageData( { path = files[i]; - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Reading HTML File " << path << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Reading HTML File " << path << std::endl, this->Coverage.Quiet); if(cmSystemTools::GetFilenameLastExtension(path) == ".html") { if(!this->ReadDelphiHTML(path.c_str())) diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 780debc..ec4cfad 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -49,8 +49,9 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser else if(name == "sourcefile") { this->FileName = atts[1]; - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: " - << this->FileName << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Reading file: " << this->FileName << std::endl, + this->Coverage.Quiet); for(size_t i=0;i < FilePaths.size();i++) { std::string finalpath = FilePaths[i] + "/" + this->FileName; @@ -148,8 +149,8 @@ bool cmParseJacocoCoverage::LoadCoverageData( { path = files[i]; - cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, - "Reading XML File " << path << std::endl); + cmCTestOptionalLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Reading XML File " << path << std::endl, this->Coverage.Quiet); if(cmSystemTools::GetFilenameLastExtension(path) == ".xml") { if(!this->ReadJacocoXML(path.c_str())) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 69573ac..e6d3960 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -463,7 +463,13 @@ cmCTest::Part cmCTest::GetPartFromName(const char* name) //---------------------------------------------------------------------- int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) { - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); + bool quiet = false; + if (command && command->ShouldBeQuiet()) + { + quiet = true; + } + + cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet); if(!this->InteractiveDebugMode) { this->BlockTestErrorDiagnostics(); @@ -478,24 +484,23 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) this->UpdateCTestConfiguration(); - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); + cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet); if ( this->ProduceXML ) { - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); - cmCTestLog(this, OUTPUT, - " Site: " << this->GetCTestConfiguration("Site") << std::endl - << " Build name: " - << cmCTest::SafeBuildIdField( - this->GetCTestConfiguration("BuildName")) - << std::endl); - cmCTestLog(this, DEBUG, "Produce XML is on" << std::endl); + cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet); + cmCTestOptionalLog(this, OUTPUT, + " Site: " << this->GetCTestConfiguration("Site") << std::endl << + " Build name: " << cmCTest::SafeBuildIdField( + this->GetCTestConfiguration("BuildName")) << std::endl, quiet); + cmCTestOptionalLog(this, DEBUG, "Produce XML is on" << std::endl, quiet); if ( this->TestModel == cmCTest::NIGHTLY && this->GetCTestConfiguration("NightlyStartTime").empty() ) { - cmCTestLog(this, WARNING, - "WARNING: No nightly start time found please set in" - " CTestConfig.cmake or DartConfig.cmake" << std::endl); - cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); + cmCTestOptionalLog(this, WARNING, + "WARNING: No nightly start time found please set in CTestConfig.cmake" + " or DartConfig.cmake" << std::endl, quiet); + cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, + quiet); return 0; } } @@ -507,8 +512,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cmMakefile *mf = lg->GetMakefile(); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) { - cmCTestLog(this, DEBUG, "Cannot find custom configuration file tree" - << std::endl); + cmCTestOptionalLog(this, DEBUG, + "Cannot find custom configuration file tree" << std::endl, quiet); return 0; } @@ -583,9 +588,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) } if (tag.empty() || (0 != command) || this->Parts[PartStart]) { - cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString() - << std::endl); - cmCTestLog(this, DEBUG, "TestModel: " << this->TestModel << std::endl); + cmCTestOptionalLog(this, DEBUG, "TestModel: " << + this->GetTestModelString() << std::endl, quiet); + cmCTestOptionalLog(this, DEBUG, "TestModel: " << + this->TestModel << std::endl, quiet); if ( this->TestModel == cmCTest::NIGHTLY ) { lctime = this->GetNightlyTime( @@ -609,8 +615,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) ofs.close(); if ( 0 == command ) { - cmCTestLog(this, OUTPUT, "Create new tag: " << tag << " - " - << this->GetTestModelString() << std::endl); + cmCTestOptionalLog(this, OUTPUT, "Create new tag: " << tag << " - " + << this->GetTestModelString() << std::endl, quiet); } } } @@ -630,8 +636,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) return 0; } - cmCTestLog(this, OUTPUT, " Use existing tag: " << tag << " - " - << this->GetTestModelString() << std::endl); + cmCTestOptionalLog(this, OUTPUT, " Use existing tag: " << tag << " - " + << this->GetTestModelString() << std::endl, quiet); } this->CurrentTag = tag; @@ -675,8 +681,8 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) if ( !fname.empty() ) { - cmCTestLog(this, OUTPUT, " Reading ctest configuration file: " - << fname << std::endl); + cmCTestOptionalLog(this, OUTPUT, " Reading ctest configuration file: " + << fname << std::endl, command->ShouldBeQuiet()); bool readit = mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str() ); if(!readit) @@ -689,19 +695,20 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) } else { - cmCTestLog(this, WARNING, + cmCTestOptionalLog(this, WARNING, "Cannot locate CTest configuration: in BuildDirectory: " - << bld_dir_fname << std::endl); - cmCTestLog(this, WARNING, + << bld_dir_fname << std::endl, command->ShouldBeQuiet()); + cmCTestOptionalLog(this, WARNING, "Cannot locate CTest configuration: in SourceDirectory: " - << src_dir_fname << std::endl); + << src_dir_fname << std::endl, command->ShouldBeQuiet()); } this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime", - "CTEST_NIGHTLY_START_TIME"); - this->SetCTestConfigurationFromCMakeVariable(mf, "Site", "CTEST_SITE"); + "CTEST_NIGHTLY_START_TIME", command->ShouldBeQuiet()); + this->SetCTestConfigurationFromCMakeVariable(mf, "Site", "CTEST_SITE", + command->ShouldBeQuiet()); this->SetCTestConfigurationFromCMakeVariable(mf, "BuildName", - "CTEST_BUILD_NAME"); + "CTEST_BUILD_NAME", command->ShouldBeQuiet()); const char* dartVersion = mf->GetDefinition("CTEST_DART_SERVER_VERSION"); if ( dartVersion ) { @@ -720,8 +727,9 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { return false; } - cmCTestLog(this, OUTPUT, " Use " << this->GetTestModelString() - << " tag: " << this->GetCurrentTag() << std::endl); + cmCTestOptionalLog(this, OUTPUT, " Use " << this->GetTestModelString() + << " tag: " << this->GetCurrentTag() << std::endl, + command->ShouldBeQuiet()); return true; } @@ -2740,10 +2748,11 @@ void cmCTest::DetermineNextDayStop() } //---------------------------------------------------------------------- -void cmCTest::SetCTestConfiguration(const char *name, const char* value) +void cmCTest::SetCTestConfiguration(const char *name, const char* value, + bool suppress) { - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfiguration:" - << name << ":" << (value ? value : "(null)") << "\n"); + cmCTestOptionalLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfiguration:" + << name << ":" << (value ? value : "(null)") << "\n", suppress); if ( !name ) { @@ -2857,7 +2866,7 @@ void cmCTest::SetConfigType(const char* ct) //---------------------------------------------------------------------- bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, const std::string& cmake_var) + const char* dconfig, const std::string& cmake_var, bool suppress) { const char* ctvar; ctvar = mf->GetDefinition(cmake_var); @@ -2865,10 +2874,10 @@ bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, { return false; } - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, - "SetCTestConfigurationFromCMakeVariable:" - << dconfig << ":" << cmake_var << std::endl); - this->SetCTestConfiguration(dconfig, ctvar); + cmCTestOptionalLog(this, HANDLER_VERBOSE_OUTPUT, + "SetCTestConfigurationFromCMakeVariable:" << dconfig << ":" << + cmake_var << std::endl, suppress); + this->SetCTestConfiguration(dconfig, ctvar, suppress); return true; } @@ -3033,12 +3042,17 @@ void cmCTest::InitStreams() this->StreamErr = &std::cerr; } -void cmCTest::Log(int logType, const char* file, int line, const char* msg) +void cmCTest::Log(int logType, const char* file, int line, const char* msg, + bool suppress) { if ( !msg || !*msg ) { return; } + if ( suppress && logType != cmCTest::ERROR_MESSAGE ) + { + return; + } if ( this->OutputLogFile ) { bool display = true; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index deb8896..88191c4 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -33,6 +33,14 @@ class cmCTestStartCommand; cmCTestLog_msg.str().c_str());\ } while ( 0 ) +#define cmCTestOptionalLog(ctSelf, logType, msg, suppress) \ + do { \ + std::ostringstream cmCTestLog_msg; \ + cmCTestLog_msg << msg; \ + (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__,\ + cmCTestLog_msg.str().c_str(), suppress);\ + } while ( 0 ) + #ifdef cerr # undef cerr #endif @@ -173,7 +181,8 @@ public: static int GetTestModelFromString(const char* str); static std::string CleanString(const std::string& str); std::string GetCTestConfiguration(const std::string& name); - void SetCTestConfiguration(const char *name, const char* value); + void SetCTestConfiguration(const char *name, const char* value, + bool suppress=false); void EmptyCTestConfiguration(); /** @@ -332,7 +341,7 @@ public: * Set the CTest variable from CMake variable */ bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, const std::string& cmake_var); + const char* dconfig, const std::string& cmake_var, bool suppress=false); //! Make string safe to be send as an URL static std::string MakeURLSafe(const std::string&); @@ -376,7 +385,8 @@ public: }; //! Add log to the output - void Log(int logType, const char* file, int line, const char* msg); + void Log(int logType, const char* file, int line, const char* msg, + bool suppress=false); //! Get the version of dart server int GetDartVersion() { return this->DartVersion; } |