Controle verbosity
This commit is contained in:
parent
0aeb0b8892
commit
a783fcb25a
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
|
cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
|
||||||
{
|
{
|
||||||
|
m_Verbose = false;
|
||||||
std::cout << "Setup proxy" << std::endl;
|
std::cout << "Setup proxy" << std::endl;
|
||||||
m_HTTPProxy = "";
|
m_HTTPProxy = "";
|
||||||
m_HTTPProxyType = 0;
|
m_HTTPProxyType = 0;
|
||||||
@ -135,10 +136,15 @@ bool cmCTestSubmit::SubmitUsingFTP(const std::string& localprefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ftpfile = ::fopen(local_file.c_str(), "rb");
|
ftpfile = ::fopen(local_file.c_str(), "rb");
|
||||||
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;
|
||||||
|
|
||||||
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
//std::cout << "File is opened: " << ftpfile << std::endl;
|
||||||
|
|
||||||
|
if ( m_Verbose )
|
||||||
|
{
|
||||||
|
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||||
|
}
|
||||||
// specify target
|
// specify target
|
||||||
::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str());
|
::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str());
|
||||||
|
|
||||||
@ -210,7 +216,10 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
|
|||||||
|
|
||||||
/* HTTP PUT please */
|
/* HTTP PUT please */
|
||||||
curl_easy_setopt(curl, CURLOPT_PUT, TRUE);
|
curl_easy_setopt(curl, CURLOPT_PUT, TRUE);
|
||||||
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
if ( m_Verbose )
|
||||||
|
{
|
||||||
|
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
std::string local_file = localprefix + "/" + files[cc];
|
std::string local_file = localprefix + "/" + files[cc];
|
||||||
std::string remote_file = remoteprefix + files[cc];
|
std::string remote_file = remoteprefix + files[cc];
|
||||||
@ -247,9 +256,11 @@ bool cmCTestSubmit::SubmitUsingHTTP(const std::string& localprefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ftpfile = ::fopen(local_file.c_str(), "rb");
|
ftpfile = ::fopen(local_file.c_str(), "rb");
|
||||||
|
if ( m_Verbose )
|
||||||
std::cout << "upload file: " << local_file.c_str() << " to "
|
{
|
||||||
<< upload_as.c_str() << " Size: " << st.st_size << std::endl;
|
std::cout << "upload file: " << local_file.c_str() << " to "
|
||||||
|
<< upload_as.c_str() << " Size: " << st.st_size << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// specify target
|
// specify target
|
||||||
@ -315,7 +326,11 @@ bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<std::string>& files,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
|
||||||
|
if ( m_Verbose )
|
||||||
|
{
|
||||||
|
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||||
|
}
|
||||||
std::string file = remoteprefix + files[cc];
|
std::string file = remoteprefix + files[cc];
|
||||||
std::string ofile = "";
|
std::string ofile = "";
|
||||||
for ( kk = 0; kk < file.size(); kk ++ )
|
for ( kk = 0; kk < file.size(); kk ++ )
|
||||||
@ -342,7 +357,10 @@ bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<std::string>& files,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string turl = url + "?xmlfile=" + ofile;
|
std::string turl = url + "?xmlfile=" + ofile;
|
||||||
std::cout << "Trigger url: " << turl.c_str() << std::endl;
|
if ( m_Verbose )
|
||||||
|
{
|
||||||
|
std::cout << "Trigger url: " << turl.c_str() << std::endl;
|
||||||
|
}
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, turl.c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, turl.c_str());
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
if ( res )
|
if ( res )
|
||||||
|
@ -30,6 +30,13 @@ class cmCTestSubmit
|
|||||||
public:
|
public:
|
||||||
cmCTestSubmit();
|
cmCTestSubmit();
|
||||||
~cmCTestSubmit() {}
|
~cmCTestSubmit() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set verbosity of send
|
||||||
|
*/
|
||||||
|
void SetVerbose(bool i) { m_Verbose = i; }
|
||||||
|
void VerboseOn() { this->SetVerbose(1); }
|
||||||
|
void VerboseOff() { this->SetVerbose(0); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit file using various ways
|
* Submit file using various ways
|
||||||
@ -56,6 +63,7 @@ private:
|
|||||||
int m_HTTPProxyType;
|
int m_HTTPProxyType;
|
||||||
std::string m_FTPProxy;
|
std::string m_FTPProxy;
|
||||||
int m_FTPProxyType;
|
int m_FTPProxyType;
|
||||||
|
bool m_Verbose;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user