ctest_submit: Add QUIET option

Specifying this option prevents CTest from printing any non-error
messages to the console for this call to ctest_submit().
This commit is contained in:
Zack Galbreath 2015-02-16 16:02:14 -05:00 committed by Brad King
parent 12db113944
commit 1643b905e0
11 changed files with 173 additions and 126 deletions

View File

@ -9,6 +9,7 @@ Submit results to a dashboard server.
[RETRY_COUNT count] [RETRY_COUNT count]
[RETRY_DELAY delay] [RETRY_DELAY delay]
[RETURN_VALUE res] [RETURN_VALUE res]
[QUIET]
) )
By default all available parts are submitted if no PARTS or FILES are By default all available parts are submitted if no PARTS or FILES are
@ -38,6 +39,9 @@ timed-out submission before attempting to re-submit.
The RETRY_COUNT option specifies how many times to retry a timed-out The RETRY_COUNT option specifies how many times to retry a timed-out
submission. submission.
The QUIET option suppresses all non-error messages that would have
otherwise been printed by this call to ctest_submit().
Submit to CDash Upload API Submit to CDash Upload API
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -22,6 +22,7 @@ cmCTestGenericHandler::cmCTestGenericHandler()
this->CTest = 0; this->CTest = 0;
this->SubmitIndex = 0; this->SubmitIndex = 0;
this->AppendXML = false; this->AppendXML = false;
this->Quiet = false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -87,6 +87,8 @@ public:
int GetSubmitIndex() { return this->SubmitIndex; } int GetSubmitIndex() { return this->SubmitIndex; }
void SetAppendXML(bool b) { this->AppendXML = b; } void SetAppendXML(bool b) { this->AppendXML = b; }
void SetQuiet(bool b) { this->Quiet = b; }
bool GetQuiet() { return this->Quiet; }
protected: protected:
bool StartResultingXML(cmCTest::Part part, bool StartResultingXML(cmCTest::Part part,
@ -94,6 +96,7 @@ protected:
bool StartLogFile(const char* name, cmGeneratedFileStream& xofs); bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
bool AppendXML; bool AppendXML;
bool Quiet;
cmSystemTools::OutputOption HandlerVerbose; cmSystemTools::OutputOption HandlerVerbose;
cmCTest *CTest; cmCTest *CTest;
t_StringToString Options; t_StringToString Options;

View File

@ -29,6 +29,7 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
this->Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX"; this->Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX";
this->Last = ct_LAST; this->Last = ct_LAST;
this->AppendXML = false; this->AppendXML = false;
this->Quiet = false;
} }
bool cmCTestHandlerCommand bool cmCTestHandlerCommand
@ -74,7 +75,7 @@ bool cmCTestHandlerCommand
{ {
this->CTest->SetCTestConfiguration("BuildDirectory", this->CTest->SetCTestConfiguration("BuildDirectory",
cmSystemTools::CollapseFullPath( cmSystemTools::CollapseFullPath(
this->Values[ct_BUILD]).c_str()); this->Values[ct_BUILD]).c_str(), this->Quiet);
} }
else else
{ {
@ -84,7 +85,7 @@ bool cmCTestHandlerCommand
{ {
this-> this->
CTest->SetCTestConfiguration("BuildDirectory", CTest->SetCTestConfiguration("BuildDirectory",
cmSystemTools::CollapseFullPath(bdir).c_str()); cmSystemTools::CollapseFullPath(bdir).c_str(), this->Quiet);
} }
else else
{ {
@ -98,13 +99,14 @@ bool cmCTestHandlerCommand
"Set source directory to: " << this->Values[ct_SOURCE] << std::endl); "Set source directory to: " << this->Values[ct_SOURCE] << std::endl);
this->CTest->SetCTestConfiguration("SourceDirectory", this->CTest->SetCTestConfiguration("SourceDirectory",
cmSystemTools::CollapseFullPath( cmSystemTools::CollapseFullPath(
this->Values[ct_SOURCE]).c_str()); this->Values[ct_SOURCE]).c_str(), this->Quiet);
} }
else else
{ {
this->CTest->SetCTestConfiguration("SourceDirectory", this->CTest->SetCTestConfiguration("SourceDirectory",
cmSystemTools::CollapseFullPath( 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;); cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;);
@ -160,6 +162,12 @@ bool cmCTestHandlerCommand::CheckArgumentKeyword(std::string const& arg)
this->AppendXML = true; this->AppendXML = true;
return true; return true;
} }
if(arg == "QUIET")
{
this->ArgumentDoing = ArgumentDoingNone;
this->Quiet = true;
return true;
}
// Check for a keyword in our argument/value table. // Check for a keyword in our argument/value table.
for(unsigned int k=0; k < this->Arguments.size(); ++k) for(unsigned int k=0; k < this->Arguments.size(); ++k)

View File

@ -62,6 +62,7 @@ protected:
unsigned int ArgumentIndex; unsigned int ArgumentIndex;
bool AppendXML; bool AppendXML;
bool Quiet;
std::string ReturnVariable; std::string ReturnVariable;
std::vector<const char*> Arguments; std::vector<const char*> Arguments;

View File

@ -44,29 +44,33 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
// error: CDash requires CTEST_DROP_LOCATION definition // error: CDash requires CTEST_DROP_LOCATION definition
// in CTestConfig.cmake // in CTestConfig.cmake
} }
this->CTest->SetCTestConfiguration("ProjectName", ctestProjectName); this->CTest->SetCTestConfiguration("ProjectName", ctestProjectName,
this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod); this->Quiet);
this->CTest->SetCTestConfiguration("DropSite", ctestDropSite); this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod,
this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation); this->Quiet);
this->CTest->SetCTestConfiguration("DropSite", ctestDropSite, this->Quiet);
this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation,
this->Quiet);
this->CTest->SetCTestConfiguration("IsCDash", this->CTest->SetCTestConfiguration("IsCDash",
ctestDropSiteCDash ? "TRUE" : "FALSE"); ctestDropSiteCDash ? "TRUE" : "FALSE", this->Quiet);
// Only propagate TriggerSite for non-CDash projects: // Only propagate TriggerSite for non-CDash projects:
// //
if ( !ctestDropSiteCDash ) if ( !ctestDropSiteCDash )
{ {
this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite); this->CTest->SetCTestConfiguration("TriggerSite", ctestTriggerSite,
this->Quiet);
} }
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
"CurlOptions", "CTEST_CURL_OPTIONS"); "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
"DropSiteUser", "CTEST_DROP_SITE_USER"); "DropSiteUser", "CTEST_DROP_SITE_USER", this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
"DropSitePassword", "CTEST_DROP_SITE_PASSWORD"); "DropSitePassword", "CTEST_DROP_SITE_PASSWORD", this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
"ScpCommand", "CTEST_SCP_COMMAND"); "ScpCommand", "CTEST_SCP_COMMAND", this->Quiet);
const char* notesFilesVariable const char* notesFilesVariable
= this->Makefile->GetDefinition("CTEST_NOTES_FILES"); = this->Makefile->GetDefinition("CTEST_NOTES_FILES");
@ -145,6 +149,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
static_cast<cmCTestSubmitHandler*>(handler)->SetOption("InternalTest", static_cast<cmCTestSubmitHandler*>(handler)->SetOption("InternalTest",
this->InternalTest ? "ON" : "OFF"); this->InternalTest ? "ON" : "OFF");
handler->SetQuiet(this->Quiet);
if (this->CDashUpload) if (this->CDashUpload)
{ {
static_cast<cmCTestSubmitHandler*>(handler)-> static_cast<cmCTestSubmitHandler*>(handler)->

View File

@ -242,9 +242,9 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); ftpfile = cmsys::SystemTools::Fopen(local_file, "rb");
*this->LogFile << "\tUpload file: " << local_file << " to " *this->LogFile << "\tUpload file: " << local_file << " to "
<< upload_as << std::endl; << upload_as << std::endl;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
<< local_file << " to " " Upload file: " << local_file << " to " << upload_as << std::endl,
<< upload_as << std::endl); this->Quiet);
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
@ -278,15 +278,15 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
if (!chunk.empty()) if (!chunk.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL output: [" cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl); << std::endl, this->Quiet);
} }
if (!chunkDebug.empty()) if (!chunkDebug.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
<< std::endl); << std::endl, this->Quiet);
} }
fclose(ftpfile); fclose(ftpfile);
@ -318,8 +318,8 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
} }
// always cleanup // always cleanup
::curl_easy_cleanup(curl); ::curl_easy_cleanup(curl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Uploaded: " + local_file cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
<< std::endl); " Uploaded: " + local_file << std::endl, this->Quiet);
} }
} }
::curl_global_cleanup(); ::curl_global_cleanup();
@ -369,14 +369,14 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
cmCurlSetCAInfo(curl); cmCurlSetCAInfo(curl);
if(verifyPeerOff) if(verifyPeerOff)
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Set CURLOPT_SSL_VERIFYPEER to off\n"); " Set CURLOPT_SSL_VERIFYPEER to off\n", this->Quiet);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
} }
if(verifyHostOff) if(verifyHostOff)
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Set CURLOPT_SSL_VERIFYHOST to off\n"); " Set CURLOPT_SSL_VERIFYHOST to off\n", this->Quiet);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); 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); unsigned long filelen = cmSystemTools::FileLength(local_file);
ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); ftpfile = cmsys::SystemTools::Fopen(local_file, "rb");
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
<< local_file << " to " " Upload file: " << local_file << " to "
<< upload_as << " Size: " << filelen << std::endl); << upload_as << " Size: " << filelen << std::endl, this->Quiet);
// specify target // specify target
::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str());
@ -529,16 +529,16 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
if (!chunk.empty()) if (!chunk.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL output: [" cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl); << std::endl, this->Quiet);
this->ParseResponse(chunk); this->ParseResponse(chunk);
} }
if (!chunkDebug.empty()) if (!chunkDebug.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
<< std::endl); << std::endl, this->Quiet);
} }
// If curl failed for any reason, or checksum fails, wait and retry // 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++) for(int i = 0; i < count; i++)
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" Submit failed, waiting " << delay << " seconds...\n"); " Submit failed, waiting " << delay << " seconds...\n",
this->Quiet);
double stop = cmSystemTools::GetTime() + delay; double stop = cmSystemTools::GetTime() + delay;
while(cmSystemTools::GetTime() < stop) while(cmSystemTools::GetTime() < stop)
@ -566,9 +567,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
cmSystemTools::Delay(100); cmSystemTools::Delay(100);
} }
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" Retry submission: Attempt " << (i + 1) << " of " " Retry submission: Attempt " << (i + 1) << " of "
<< count << std::endl); << count << std::endl, this->Quiet);
::fclose(ftpfile); ::fclose(ftpfile);
ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); ftpfile = cmsys::SystemTools::Fopen(local_file, "rb");
@ -582,9 +583,9 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
if (!chunk.empty()) if (!chunk.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL output: [" cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl); << std::endl, this->Quiet);
this->ParseResponse(chunk); this->ParseResponse(chunk);
} }
@ -624,8 +625,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
} }
// always cleanup // always cleanup
::curl_easy_cleanup(curl); ::curl_easy_cleanup(curl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Uploaded: " + local_file cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
<< std::endl); " Uploaded: " + local_file << std::endl, this->Quiet);
} }
} }
::curl_global_cleanup(); ::curl_global_cleanup();
@ -677,6 +678,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
{ {
CURL *curl; CURL *curl;
char error_buffer[1024]; char error_buffer[1024];
/* In windows, this will init the winsock stuff */ /* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL); ::curl_global_init(CURL_GLOBAL_ALL);
@ -756,8 +758,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
= url + ((url.find("?",0) == std::string::npos) ? "?" : "&") = url + ((url.find("?",0) == std::string::npos) ? "?" : "&")
+ "xmlfile=" + ofile; + "xmlfile=" + ofile;
*this->LogFile << "Trigger url: " << turl << std::endl; *this->LogFile << "Trigger url: " << turl << std::endl;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
<< turl << std::endl); " Trigger url: " << turl << std::endl, this->Quiet);
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_easy_setopt(curl, CURLOPT_URL, turl.c_str()); curl_easy_setopt(curl, CURLOPT_URL, turl.c_str());
if ( curl_easy_perform(curl) ) if ( curl_easy_perform(curl) )
@ -786,25 +788,26 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
if (!chunk.empty()) if (!chunk.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL output: [" cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl); << std::endl, this->Quiet);
} }
if (!chunkDebug.empty()) if (!chunkDebug.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" cmCTestOptionalLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size())
<< "]" << std::endl); << "]" << std::endl, this->Quiet);
} }
// always cleanup // always cleanup
::curl_easy_cleanup(curl); ::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(); ::curl_global_cleanup();
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Dart server triggered..." cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Dart server triggered..."
<< std::endl); << std::endl, this->Quiet);
return true; return true;
} }
@ -821,6 +824,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
{ {
return 0; return 0;
} }
std::vector<const char*> argv; std::vector<const char*> argv;
argv.push_back(scp_command.c_str()); // Scp command argv.push_back(scp_command.c_str()); // Scp command
argv.push_back(scp_command.c_str()); // Dummy string for file argv.push_back(scp_command.c_str()); // Dummy string for file
@ -845,9 +849,9 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
argv[1] = lfname.c_str(); argv[1] = lfname.c_str();
std::string rfname = url + "/" + remoteprefix + *file; std::string rfname = url + "/" + remoteprefix + *file;
argv[2] = rfname.c_str(); argv[2] = rfname.c_str();
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Execute \"" << argv[0] cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
<< "\" \"" << argv[1] << "\" \"" "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
<< argv[2] << "\"" << std::endl); << argv[2] << "\"" << std::endl, this->Quiet);
*this->LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \"" *this->LogFile << "Execute \"" << argv[0] << "\" \"" << argv[1] << "\" \""
<< argv[2] << "\"" << std::endl; << argv[2] << "\"" << std::endl;
@ -858,8 +862,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
while(cmsysProcess_WaitForData(cp, &data, &length, 0)) while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
cmCTestLogWrite(data, length)); cmCTestLogWrite(data, length), this->Quiet);
} }
cmsysProcess_WaitForExit(cp, 0); cmsysProcess_WaitForExit(cp, 0);
@ -871,8 +875,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
retVal = cmsysProcess_GetExitValue(cp); retVal = cmsysProcess_GetExitValue(cp);
if ( retVal != 0 ) if ( retVal != 0 )
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\tSCP returned: " cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
<< retVal << std::endl); "\tSCP returned: " << retVal << std::endl, this->Quiet);
*this->LogFile << "\tSCP returned: " << retVal << std::endl; *this->LogFile << "\tSCP returned: " << retVal << std::endl;
problems ++; problems ++;
} }
@ -927,6 +931,7 @@ bool cmCTestSubmitHandler::SubmitUsingCP(
<< "\tdestination: " << destination << std::endl); << "\tdestination: " << destination << std::endl);
return 0; return 0;
} }
cmCTest::SetOfStrings::const_iterator file; cmCTest::SetOfStrings::const_iterator file;
bool problems = false; bool problems = false;
for ( file = files.begin(); file != files.end(); ++file ) for ( file = files.begin(); file != files.end(); ++file )
@ -936,9 +941,9 @@ bool cmCTestSubmitHandler::SubmitUsingCP(
lfname += "/" + *file; lfname += "/" + *file;
std::string rfname = destination + "/" + remoteprefix + *file; std::string rfname = destination + "/" + remoteprefix + *file;
cmSystemTools::CopyFileAlways(lfname, rfname); cmSystemTools::CopyFileAlways(lfname, rfname);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: "
<< lfname << " to " << lfname << " to "
<< rfname << std::endl); << rfname << std::endl, this->Quiet);
} }
std::string tagDoneFile = destination + "/" + remoteprefix + "DONE"; std::string tagDoneFile = destination + "/" + remoteprefix + "DONE";
cmSystemTools::Touch(tagDoneFile, true); cmSystemTools::Touch(tagDoneFile, true);
@ -971,8 +976,9 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix,
xmlrpc_env_init(&env); xmlrpc_env_init(&env);
/* Call the famous server at UserLand. */ /* Call the famous server at UserLand. */
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submitting to: " cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submitting to: "
<< realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl); << realURL.c_str() << " (" << remoteprefix.c_str() << ")" << std::endl,
this->Quiet);
cmCTest::SetOfStrings::const_iterator file; cmCTest::SetOfStrings::const_iterator file;
for ( file = files.begin(); file != files.end(); ++file ) for ( file = files.begin(); file != files.end(); ++file )
{ {
@ -983,8 +989,8 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix,
{ {
local_file = localprefix + "/" + *file; local_file = localprefix + "/" + *file;
} }
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submit file: " cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submit file: "
<< local_file.c_str() << std::endl); << local_file.c_str() << std::endl, this->Quiet);
struct stat st; struct stat st;
if ( ::stat(local_file.c_str(), &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 ) if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
{ {
url += this->CTest->GetCTestConfiguration("DropSiteUser"); url += this->CTest->GetCTestConfiguration("DropSiteUser");
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSiteUser").c_str()); this->CTest->GetCTestConfiguration("DropSiteUser").c_str(),
this->Quiet);
if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 ) if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
{ {
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******",
this->Quiet);
} }
url += "@"; url += "@";
} }
@ -1147,8 +1155,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
<< "datafilesmd5[0]=" << md5sum << "&" << "datafilesmd5[0]=" << md5sum << "&"
<< "type=" << curl.Escape(typeString); << "type=" << curl.Escape(typeString);
std::string fields = str.str(); std::string fields = str.str();
cmCTestLog(this->CTest, DEBUG, "fields: " << fields << "\nurl:" cmCTestOptionalLog(this->CTest, DEBUG, "fields: " << fields << "\nurl:"
<< url << "\nfile: " << file << "\n"); << url << "\nfile: " << file << "\n", this->Quiet);
std::string response; std::string response;
if(!curl.HttpRequest(url, fields, response)) if(!curl.HttpRequest(url, fields, response))
{ {
@ -1156,8 +1164,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
"Error in HttpRequest\n" << response); "Error in HttpRequest\n" << response);
return -1; return -1;
} }
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Request upload response: [" << response << "]\n"); "Request upload response: [" << response << "]\n", this->Quiet);
Json::Value json; Json::Value json;
Json::Reader reader; Json::Reader reader;
if(!reader.parse(response, json)) if(!reader.parse(response, json))
@ -1179,9 +1187,9 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
int datares = json["datafilesmd5"][0].asInt(); int datares = json["datafilesmd5"][0].asInt();
if(datares == 1) if(datares == 1)
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"File already exists on CDash, skip upload " "File already exists on CDash, skip upload " << file << "\n",
<< file << "\n"); this->Quiet);
return 0; return 0;
} }
} }
@ -1213,8 +1221,8 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
<< reader.getFormattedErrorMessages() << "\n"); << reader.getFormattedErrorMessages() << "\n");
return -1; return -1;
} }
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Upload file response: [" << response << "]\n"); "Upload file response: [" << response << "]\n", this->Quiet );
return 0; return 0;
} }
@ -1311,13 +1319,13 @@ int cmCTestSubmitHandler::ProcessHandler()
if (!this->HTTPProxy.empty()) if (!this->HTTPProxy.empty())
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: "
<< this->HTTPProxy << std::endl); << this->HTTPProxy << std::endl, this->Quiet);
} }
if (!this->FTPProxy.empty()) if (!this->FTPProxy.empty())
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: " cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: "
<< this->FTPProxy << std::endl); << this->FTPProxy << std::endl, this->Quiet);
} }
cmGeneratedFileStream ofs; cmGeneratedFileStream ofs;
this->StartLogFile("Submit", ofs); this->StartLogFile("Submit", ofs);
@ -1349,16 +1357,16 @@ int cmCTestSubmitHandler::ProcessHandler()
= buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(); = buildDirectory + "/Testing/" + this->CTest->GetCurrentTag();
std::string::size_type glen = gpath.size() + 1; std::string::size_type glen = gpath.size() + 1;
gpath = gpath + "/CoverageLog*"; gpath = gpath + "/CoverageLog*";
cmCTestLog(this->CTest, DEBUG, "Globbing for: " << gpath cmCTestOptionalLog(this->CTest, DEBUG, "Globbing for: " << gpath
<< std::endl); << std::endl, this->Quiet);
if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) ) if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) )
{ {
size_t cc; size_t cc;
for ( cc = 0; cc < gfiles.size(); cc ++ ) for ( cc = 0; cc < gfiles.size(); cc ++ )
{ {
gfiles[cc] = gfiles[cc].substr(glen); gfiles[cc] = gfiles[cc].substr(glen);
cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc] cmCTestOptionalLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc]
<< std::endl); << std::endl, this->Quiet);
this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfiles[cc].c_str()); this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfiles[cc].c_str());
} }
} }
@ -1398,14 +1406,14 @@ int cmCTestSubmitHandler::ProcessHandler()
cnt ++; cnt ++;
} }
} }
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Submit files (using " cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Submit files (using "
<< this->CTest->GetCTestConfiguration("DropMethod") << ")" << this->CTest->GetCTestConfiguration("DropMethod") << ")"
<< std::endl); << std::endl, this->Quiet);
const char* specificTrack = this->CTest->GetSpecificTrack(); const char* specificTrack = this->CTest->GetSpecificTrack();
if ( specificTrack ) if ( specificTrack )
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Send to track: " cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Send to track: "
<< specificTrack << std::endl); << specificTrack << std::endl, this->Quiet);
} }
this->SetLogFile(&ofs); this->SetLogFile(&ofs);
@ -1414,9 +1422,9 @@ int cmCTestSubmitHandler::ProcessHandler()
if ( dropMethod == "" || dropMethod == "ftp" ) if ( dropMethod == "" || dropMethod == "ftp" )
{ {
ofs << "Using drop method: FTP" << std::endl; ofs << "Using drop method: FTP" << std::endl;
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using FTP submit method" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
<< std::endl " Using FTP submit method" << std::endl << " Drop site: ftp://",
<< " Drop site: ftp://"); this->Quiet);
std::string url = "ftp://"; std::string url = "ftp://";
url += cmCTest::MakeURLSafe( url += cmCTest::MakeURLSafe(
this->CTest->GetCTestConfiguration("DropSiteUser")) + ":" + this->CTest->GetCTestConfiguration("DropSiteUser")) + ":" +
@ -1427,18 +1435,20 @@ int cmCTestSubmitHandler::ProcessHandler()
this->CTest->GetCTestConfiguration("DropLocation")); this->CTest->GetCTestConfiguration("DropLocation"));
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration( this->CTest->GetCTestConfiguration(
"DropSiteUser").c_str()); "DropSiteUser").c_str(), this->Quiet);
if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) 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("DropSite")
<< this->CTest->GetCTestConfiguration("DropLocation") << std::endl); << this->CTest->GetCTestConfiguration("DropLocation") << std::endl,
this->Quiet);
if ( !this->SubmitUsingFTP(buildDirectory + "/Testing/" if ( !this->SubmitUsingFTP(buildDirectory + "/Testing/"
+ this->CTest->GetCurrentTag(), + this->CTest->GetCurrentTag(),
files, prefix, url) ) files, prefix, url) )
@ -1451,11 +1461,12 @@ int cmCTestSubmitHandler::ProcessHandler()
} }
if(!this->CDash) if(!this->CDash)
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" Using HTTP trigger method"
<< std::endl << std::endl
<< " Trigger site: " << " Trigger site: "
<< this->CTest->GetCTestConfiguration("TriggerSite") << this->CTest->GetCTestConfiguration("TriggerSite")
<< std::endl); << std::endl, this->Quiet);
if ( !this-> if ( !this->
TriggerUsingHTTP(files, prefix, TriggerUsingHTTP(files, prefix,
this->CTest->GetCTestConfiguration("TriggerSite"))) this->CTest->GetCTestConfiguration("TriggerSite")))
@ -1465,8 +1476,8 @@ int cmCTestSubmitHandler::ProcessHandler()
ofs << " Problems when triggering via HTTP" << std::endl; ofs << " Problems when triggering via HTTP" << std::endl;
return -1; return -1;
} }
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
<< std::endl); " Submission successful" << std::endl, this->Quiet);
ofs << " Submission successful" << std::endl; ofs << " Submission successful" << std::endl;
return 0; return 0;
} }
@ -1476,27 +1487,30 @@ int cmCTestSubmitHandler::ProcessHandler()
std::string url = dropMethod; std::string url = dropMethod;
url += "://"; url += "://";
ofs << "Using drop method: " << dropMethod << std::endl; ofs << "Using drop method: " << dropMethod << std::endl;
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
<< std::endl " Using HTTP submit method" << std::endl << " Drop site:" << url,
<< " Drop site:" << url); this->Quiet);
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{ {
url += this->CTest->GetCTestConfiguration("DropSiteUser"); url += this->CTest->GetCTestConfiguration("DropSiteUser");
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSiteUser").c_str()); this->CTest->GetCTestConfiguration("DropSiteUser").c_str(),
this->Quiet);
if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty())
{ {
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******",
this->Quiet);
} }
url += "@"; url += "@";
cmCTestLog(this->CTest, HANDLER_OUTPUT, "@"); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "@", this->Quiet);
} }
url += this->CTest->GetCTestConfiguration("DropSite") + url += this->CTest->GetCTestConfiguration("DropSite") +
this->CTest->GetCTestConfiguration("DropLocation"); this->CTest->GetCTestConfiguration("DropLocation");
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSite") this->CTest->GetCTestConfiguration("DropSite")
<< this->CTest->GetCTestConfiguration("DropLocation") << std::endl); << this->CTest->GetCTestConfiguration("DropLocation") << std::endl,
this->Quiet);
if ( !this->SubmitUsingHTTP(buildDirectory + "/Testing/" + if ( !this->SubmitUsingHTTP(buildDirectory + "/Testing/" +
this->CTest->GetCurrentTag(), files, prefix, url) ) this->CTest->GetCurrentTag(), files, prefix, url) )
{ {
@ -1507,11 +1521,10 @@ int cmCTestSubmitHandler::ProcessHandler()
} }
if(!this->CDash) if(!this->CDash)
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP trigger method" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
<< std::endl " Using HTTP trigger method" << std::endl << " Trigger site: "
<< " Trigger site: "
<< this->CTest->GetCTestConfiguration("TriggerSite") << this->CTest->GetCTestConfiguration("TriggerSite")
<< std::endl); << std::endl, this->Quiet);
if ( !this-> if ( !this->
TriggerUsingHTTP(files, prefix, TriggerUsingHTTP(files, prefix,
this->CTest->GetCTestConfiguration("TriggerSite"))) this->CTest->GetCTestConfiguration("TriggerSite")))
@ -1530,8 +1543,10 @@ int cmCTestSubmitHandler::ProcessHandler()
} }
else else
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
(this->HasWarnings ? ", with warnings." : "") << std::endl); " Submission successful" <<
(this->HasWarnings ? ", with warnings." : "") << std::endl,
this->Quiet);
ofs << " Submission successful" << ofs << " Submission successful" <<
(this->HasWarnings ? ", with warnings." : "") << std::endl; (this->HasWarnings ? ", with warnings." : "") << std::endl;
} }
@ -1542,8 +1557,8 @@ int cmCTestSubmitHandler::ProcessHandler()
{ {
#if defined(CTEST_USE_XMLRPC) #if defined(CTEST_USE_XMLRPC)
ofs << "Using drop method: XML-RPC" << std::endl; ofs << "Using drop method: XML-RPC" << std::endl;
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using XML-RPC submit method" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
<< std::endl); " Using XML-RPC submit method" << std::endl, this->Quiet);
std::string url = this->CTest->GetCTestConfiguration("DropSite"); std::string url = this->CTest->GetCTestConfiguration("DropSite");
prefix = this->CTest->GetCTestConfiguration("DropLocation"); prefix = this->CTest->GetCTestConfiguration("DropLocation");
if ( !this->SubmitUsingXMLRPC(buildDirectory + "/Testing/" + if ( !this->SubmitUsingXMLRPC(buildDirectory + "/Testing/" +
@ -1554,8 +1569,8 @@ int cmCTestSubmitHandler::ProcessHandler()
ofs << " Problems when submitting via XML-RPC" << std::endl; ofs << " Problems when submitting via XML-RPC" << std::endl;
return -1; return -1;
} }
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
<< std::endl); << std::endl, this->Quiet);
ofs << " Submission successful" << std::endl; ofs << " Submission successful" << std::endl;
return 0; return 0;
#else #else
@ -1593,8 +1608,8 @@ int cmCTestSubmitHandler::ProcessHandler()
return -1; return -1;
} }
cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmSystemTools::ChangeDirectory(oldWorkingDirectory);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
<< std::endl); << std::endl, this->Quiet);
ofs << " Submission successful" << std::endl; ofs << " Submission successful" << std::endl;
return 0; return 0;
} }
@ -1609,8 +1624,8 @@ int cmCTestSubmitHandler::ProcessHandler()
std::string std::string
oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(buildDirectory); cmSystemTools::ChangeDirectory(buildDirectory);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
<< buildDirectory << std::endl); " Change directory: " << buildDirectory << std::endl, this->Quiet);
if ( !this->SubmitUsingCP( if ( !this->SubmitUsingCP(
"Testing/"+this->CTest->GetCurrentTag(), "Testing/"+this->CTest->GetCurrentTag(),
@ -1626,8 +1641,8 @@ int cmCTestSubmitHandler::ProcessHandler()
return -1; return -1;
} }
cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmSystemTools::ChangeDirectory(oldWorkingDirectory);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
<< std::endl); << std::endl, this->Quiet);
ofs << " Submission successful" << std::endl; ofs << " Submission successful" << std::endl;
return 0; return 0;
} }

View File

@ -0,0 +1 @@
(-1|255)

View File

@ -0,0 +1,4 @@
*Error when uploading file: .*/Configure.xml
*Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*)
*Problems when submitting via HTTP
*Error in read script: .*/Tests/RunCMake/ctest_submit/CDashSubmitQuiet/test.cmake

View File

@ -0,0 +1,3 @@
Configure project
Each . represents 1024 bytes of output
. Size of output: 0K$

View File

@ -24,6 +24,7 @@ run_ctest_submit(CDashUploadFILES CDASH_UPLOAD bad-upload FILES)
run_ctest_submit(CDashUploadRETRY_COUNT CDASH_UPLOAD bad-upload RETRY_COUNT) run_ctest_submit(CDashUploadRETRY_COUNT CDASH_UPLOAD bad-upload RETRY_COUNT)
run_ctest_submit(CDashUploadRETRY_DELAY CDASH_UPLOAD bad-upload RETRY_DELAY) run_ctest_submit(CDashUploadRETRY_DELAY CDASH_UPLOAD bad-upload RETRY_DELAY)
run_ctest_submit(CDashUploadNone CDASH_UPLOAD) run_ctest_submit(CDashUploadNone CDASH_UPLOAD)
run_ctest_submit(CDashSubmitQuiet QUIET)
function(run_ctest_CDashUploadFTP) function(run_ctest_CDashUploadFTP)
set(CASE_DROP_METHOD ftp) set(CASE_DROP_METHOD ftp)