ENH: Cleanup the output

This commit is contained in:
Andy Cedilnik 2003-08-11 12:19:46 -04:00
parent 0b0a732f26
commit d9cb234d98
2 changed files with 103 additions and 95 deletions

View File

@ -24,7 +24,6 @@
cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy() cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
{ {
m_Verbose = false; m_Verbose = false;
std::cout << "Setup proxy" << std::endl;
m_HTTPProxy = ""; m_HTTPProxy = "";
m_HTTPProxyType = 0; m_HTTPProxyType = 0;
if ( getenv("HTTP_PROXY") ) if ( getenv("HTTP_PROXY") )
@ -83,8 +82,14 @@ cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
} }
} }
} }
std::cout << this << " HTTP Proxy: " << m_HTTPProxy << std::endl; if ( m_HTTPProxy.size() > 0 )
{
std::cout << " Use HTTP Proxy: " << m_HTTPProxy << std::endl;
}
if ( m_FTPProxy.size() > 0 )
{
std::cout << " Use FTP Proxy: " << m_FTPProxy << std::endl;
}
} }
bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix, bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix,
@ -138,12 +143,10 @@ bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix,
ftpfile = ::fopen(local_file.c_str(), "rb"); ftpfile = ::fopen(local_file.c_str(), "rb");
if ( m_Verbose ) if ( m_Verbose )
{ {
std::cout << "upload file: " << local_file.c_str() << " to " std::cout << " Upload file: " << local_file.c_str() << " to "
<< upload_as.c_str() << std::endl; << upload_as.c_str() << std::endl;
} }
//std::cout << "File is opened: " << ftpfile << std::endl;
if ( m_Verbose ) if ( m_Verbose )
{ {
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
@ -162,7 +165,7 @@ bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix,
fclose(ftpfile); fclose(ftpfile);
if ( res ) if ( res )
{ {
std::cout << "Error when uploading" << std::endl; std::cout << " Error when uploading file: " << local_file.c_str() << std::endl;
::curl_easy_cleanup(curl); ::curl_easy_cleanup(curl);
::curl_global_cleanup(); ::curl_global_cleanup();
return false; return false;
@ -182,7 +185,6 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
const std::string& remoteprefix, const std::string& remoteprefix,
const std::string& url) const std::string& url)
{ {
std::cout << this << " Using proxy: " << m_HTTPProxy << std::endl;
CURL *curl; CURL *curl;
CURLcode res; CURLcode res;
FILE* ftpfile; FILE* ftpfile;
@ -261,7 +263,7 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
ftpfile = ::fopen(local_file.c_str(), "rb"); ftpfile = ::fopen(local_file.c_str(), "rb");
if ( m_Verbose ) if ( m_Verbose )
{ {
std::cout << "upload file: " << local_file.c_str() << " to " std::cout << " Upload file: " << local_file.c_str() << " to "
<< upload_as.c_str() << " Size: " << st.st_size << std::endl; << upload_as.c_str() << " Size: " << st.st_size << std::endl;
} }
@ -281,13 +283,14 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
fclose(ftpfile); fclose(ftpfile);
if ( res ) if ( res )
{ {
std::cout << "Error when uploading" << std::endl; std::cout << " Error when uploading file: " << local_file.c_str() << std::endl;
::curl_easy_cleanup(curl); ::curl_easy_cleanup(curl);
::curl_global_cleanup(); ::curl_global_cleanup();
return false; return false;
} }
// always cleanup // always cleanup
::curl_easy_cleanup(curl); ::curl_easy_cleanup(curl);
std::cout << " Uploaded: " + local_file << std::endl;
} }
} }
::curl_global_cleanup(); ::curl_global_cleanup();
@ -364,7 +367,7 @@ bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<std::string>& files,
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) )
{ {
std::cout << "Error when uploading" << std::endl; std::cout << " Error when triggering: " << turl.c_str() << std::endl;
::curl_easy_cleanup(curl); ::curl_easy_cleanup(curl);
::curl_global_cleanup(); ::curl_global_cleanup();
return false; return false;

View File

@ -1919,7 +1919,7 @@ int cmCTest::SubmitResults()
if ( m_DartConfiguration["DropMethod"] == "" || if ( m_DartConfiguration["DropMethod"] == "" ||
m_DartConfiguration["DropMethod"] == "ftp" ) m_DartConfiguration["DropMethod"] == "ftp" )
{ {
std::cout << "FTP submit method" << std::endl; std::cout << " Using FTP submit method" << std::endl;
std::string url = "ftp://"; std::string url = "ftp://";
url += cmCTest::MakeURLSafe(m_DartConfiguration["DropSiteUser"]) + ":" + url += cmCTest::MakeURLSafe(m_DartConfiguration["DropSiteUser"]) + ":" +
cmCTest::MakeURLSafe(m_DartConfiguration["DropSitePassword"]) + "@" + cmCTest::MakeURLSafe(m_DartConfiguration["DropSitePassword"]) + "@" +
@ -1928,17 +1928,20 @@ int cmCTest::SubmitResults()
if ( !submit.SubmitUsingFTP(m_ToplevelPath+"/Testing/"+m_CurrentTag, if ( !submit.SubmitUsingFTP(m_ToplevelPath+"/Testing/"+m_CurrentTag,
files, prefix, url) ) files, prefix, url) )
{ {
std::cout << " Problems when submitting via FTP" << std::endl;
return 0; return 0;
} }
if ( !submit.TriggerUsingHTTP(files, prefix, m_DartConfiguration["TriggerSite"]) ) if ( !submit.TriggerUsingHTTP(files, prefix, m_DartConfiguration["TriggerSite"]) )
{ {
std::cout << " Problems when triggering via HTTP" << std::endl;
return 0; return 0;
} }
std::cout << " Submission successfull" << std::endl;
return 1; return 1;
} }
else if ( m_DartConfiguration["DropMethod"] == "http" ) else if ( m_DartConfiguration["DropMethod"] == "http" )
{ {
std::cout << "HTTP submit method" << std::endl; std::cout << " Using HTTP submit method" << std::endl;
std::string url = "http://"; std::string url = "http://";
if ( m_DartConfiguration["DropSiteUser"].size() > 0 ) if ( m_DartConfiguration["DropSiteUser"].size() > 0 )
{ {
@ -1952,10 +1955,12 @@ int cmCTest::SubmitResults()
url += m_DartConfiguration["DropSite"] + m_DartConfiguration["DropLocation"]; url += m_DartConfiguration["DropSite"] + m_DartConfiguration["DropLocation"];
if ( !submit.SubmitUsingHTTP(m_ToplevelPath+"/Testing/"+m_CurrentTag, files, prefix, url) ) if ( !submit.SubmitUsingHTTP(m_ToplevelPath+"/Testing/"+m_CurrentTag, files, prefix, url) )
{ {
std::cout << " Problems when submitting via HTTP" << std::endl;
return 0; return 0;
} }
if ( !submit.TriggerUsingHTTP(files, prefix, m_DartConfiguration["TriggerSite"]) ) if ( !submit.TriggerUsingHTTP(files, prefix, m_DartConfiguration["TriggerSite"]) )
{ {
std::cout << " Problems when triggering via HTTP" << std::endl;
return 0; return 0;
} }
std::cout << " Submission successfull" << std::endl; std::cout << " Submission successfull" << std::endl;