summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/ctest_update.rst7
-rw-r--r--Source/CTest/cmCTestUpdateCommand.cxx44
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx39
-rw-r--r--Tests/CTestUpdateCommon.cmake6
-rw-r--r--Tests/CTestUpdateGIT.cmake.in33
5 files changed, 89 insertions, 40 deletions
diff --git a/Help/command/ctest_update.rst b/Help/command/ctest_update.rst
index d34e192..01e357b 100644
--- a/Help/command/ctest_update.rst
+++ b/Help/command/ctest_update.rst
@@ -5,9 +5,14 @@ Update the work tree from version control.
::
- ctest_update([SOURCE source] [RETURN_VALUE res])
+ ctest_update([SOURCE source] [RETURN_VALUE res] [QUIET])
Updates the given source directory and stores results in Update.xml.
If no SOURCE is given, the CTEST_SOURCE_DIRECTORY variable is used.
The RETURN_VALUE option specifies a variable in which to store the
result, which is the number of files updated or -1 on error.
+
+If QUIET is specified then CTest will suppress most non-error
+messages that it would have otherwise printed to the console.
+CTest will still report the new revision of the repository
+and any conflicting files that were found.
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/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake
index 97153f0..77b3398 100644
--- a/Tests/CTestUpdateCommon.cmake
+++ b/Tests/CTestUpdateCommon.cmake
@@ -13,6 +13,9 @@ function(run_child)
message(FATAL_ERROR "Child failed (${FAILED}), output is\n ${OUTPUT}\n"
"Command = [${ARGN}]\n")
endif()
+
+ # Pass output back up to the parent scope for possible further inspection.
+ set(OUTPUT "${OUTPUT}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
@@ -269,6 +272,9 @@ function(run_dashboard_script bin_dir)
Updated{subdir/bar.txt}
)
endif()
+
+ # Pass console output up to the parent, in case they'd like to inspect it.
+ set(OUTPUT "${OUTPUT}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in
index 41b732b..5987a30 100644
--- a/Tests/CTestUpdateGIT.cmake.in
+++ b/Tests/CTestUpdateGIT.cmake.in
@@ -334,3 +334,36 @@ set(CTEST_UPDATE_VERSION_ONLY TRUE)
# Run the dashboard script with CTest.
set(NO_UPDATE 1)
run_dashboard_script(dash-binary-no-update)
+
+rewind_source(dash-source)
+
+#-----------------------------------------------------------------------------
+# Test ctest_update(QUIET)
+set(NO_UPDATE 0)
+message("Running CTest Dashboard Script (update quietly)...")
+
+create_dashboard_script(dash-binary-quiet
+ "# git command configuration
+set(CTEST_GIT_COMMAND \"${GIT}\")
+set(CTEST_GIT_UPDATE_OPTIONS)
+set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master)
+")
+
+# We need to modify the created dashboard script to include our "QUIET"
+# option.
+set(filename "${TOP}/dash-binary-quiet.cmake")
+file(READ "${filename}" contents)
+string(REPLACE
+ [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})]=]
+ [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY} QUIET)]=]
+ contents
+ "${contents}")
+file(WRITE "${filename}" "${contents}")
+
+# Run the dashboard script with CTest.
+run_dashboard_script(dash-binary-quiet)
+
+# Make sure the output seems quiet.
+if("${OUTPUT}" MATCHES "Updating the repository")
+ message(FATAL_ERROR "Found 'Updating the repository' in quiet output")
+endif()