CTest: Add function GetSubmitURL

This commit is contained in:
Regina Pfeifer
2018-11-28 22:11:14 +01:00
committed by Brad King
parent 2bedd5fb7c
commit 65f1fc9d63
4 changed files with 30 additions and 39 deletions

View File

@@ -494,23 +494,6 @@ void cmCTestSubmitHandler::ParseResponse(
}
}
void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod,
std::string& url)
{
dropMethod = this->CTest->GetCTestConfiguration("DropMethod");
url = dropMethod;
url += "://";
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) {
url += this->CTest->GetCTestConfiguration("DropSiteUser");
if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) {
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
}
url += "@";
}
url += this->CTest->GetCTestConfiguration("DropSite") +
this->CTest->GetCTestConfiguration("DropLocation");
}
int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
std::string const& typeString)
{
@@ -531,9 +514,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
curl.SetCurlOptions(args);
curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
curl.SetHttpHeaders(this->HttpHeaders);
std::string dropMethod;
std::string url;
this->ConstructCDashURL(dropMethod, url);
std::string url = this->CTest->GetSubmitURL();
std::string fields;
std::string::size_type pos = url.find('?');
if (pos != std::string::npos) {
@@ -878,23 +859,7 @@ int cmCTestSubmitHandler::ProcessHandler()
}
this->SetLogFile(&ofs);
std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod"));
if (dropMethod.empty()) {
dropMethod = "http";
}
std::string url = dropMethod;
url += "://";
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) {
url += this->CTest->GetCTestConfiguration("DropSiteUser");
if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) {
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
}
url += "@";
}
url += this->CTest->GetCTestConfiguration("DropSite") +
this->CTest->GetCTestConfiguration("DropLocation");
std::string url = this->CTest->GetSubmitURL();
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
" SubmitURL: " << url << '\n', this->Quiet);
if (!this->SubmitUsingHTTP(buildDirectory + "/Testing/" +

View File

@@ -48,8 +48,6 @@ public:
this->HttpHeaders = v;
}
void ConstructCDashURL(std::string& dropMethod, std::string& url);
private:
void SetLogFile(std::ostream* ost) { this->LogFile = ost; }

View File

@@ -2626,6 +2626,32 @@ void cmCTest::SetCTestConfiguration(const char* name, const char* value,
this->CTestConfiguration[name] = value;
}
std::string cmCTest::GetSubmitURL()
{
std::string url;
{
std::string method = this->GetCTestConfiguration("DropMethod");
std::string user = this->GetCTestConfiguration("DropSiteUser");
std::string password = this->GetCTestConfiguration("DropSitePassword");
std::string site = this->GetCTestConfiguration("DropSite");
std::string location = this->GetCTestConfiguration("DropLocation");
url = method.empty() ? "http" : method;
url += "://";
if (!user.empty()) {
url += user;
if (!password.empty()) {
url += ':';
url += password;
}
url += '@';
}
url += site;
url += location;
}
return url;
}
std::string cmCTest::GetCurrentTag()
{
return this->CurrentTag;

View File

@@ -176,6 +176,8 @@ public:
bool suppress = false);
void EmptyCTestConfiguration();
std::string GetSubmitURL();
/**
* constructor and destructor
*/