CTestSubmit: Prefer concrete variables over map entries

This commit is contained in:
Daniel Pfeifer
2024-10-23 00:15:59 +02:00
parent 063e98eb4b
commit 8cac63814c
3 changed files with 25 additions and 15 deletions

View File

@@ -164,15 +164,16 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
handler->SetHttpHeaders(this->HttpHeaders);
}
handler->SetOption("RetryDelay", this->RetryDelay);
handler->SetOption("RetryCount", this->RetryCount);
handler->SetOption("InternalTest", this->InternalTest ? "ON" : "OFF");
handler->RetryDelay = this->RetryDelay;
handler->RetryCount = this->RetryCount;
handler->InternalTest = this->InternalTest;
handler->SetQuiet(this->Quiet);
if (this->CDashUpload) {
handler->SetOption("CDashUploadFile", this->CDashUploadFile);
handler->SetOption("CDashUploadType", this->CDashUploadType);
handler->CDashUpload = true;
handler->CDashUploadFile = this->CDashUploadFile;
handler->CDashUploadType = this->CDashUploadType;
}
return handler;
}

View File

@@ -286,7 +286,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
upload_as += "&MD5=";
if (this->GetOption("InternalTest").IsOn()) {
if (this->InternalTest) {
upload_as += "ffffffffffffffffffffffffffffffff";
} else {
cmCryptoHash hasher(cmCryptoHash::AlgoMD5);
@@ -368,8 +368,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
bool successful_submission = response_code == 200;
if (!successful_submission || this->HasErrors) {
std::string retryDelay = *this->GetOption("RetryDelay");
std::string retryCount = *this->GetOption("RetryCount");
std::string retryDelay = this->RetryDelay;
std::string retryCount = this->RetryCount;
auto delay = cmDuration(
retryDelay.empty()
@@ -528,11 +528,11 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
fields = url.substr(pos + 1);
url.erase(pos);
}
bool internalTest = this->GetOption("InternalTest").IsOn();
bool internalTest = this->InternalTest;
// Get RETRY_COUNT and RETRY_DELAY values if they were set.
std::string retryDelayString = *this->GetOption("RetryDelay");
std::string retryCountString = *this->GetOption("RetryCount");
std::string retryDelayString = this->RetryDelay;
std::string retryCountString = this->RetryCount;
auto retryDelay = std::chrono::seconds(0);
if (!retryDelayString.empty()) {
unsigned long retryDelayValue = 0;
@@ -721,10 +721,9 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
int cmCTestSubmitHandler::ProcessHandler()
{
cmValue cdashUploadFile = this->GetOption("CDashUploadFile");
cmValue cdashUploadType = this->GetOption("CDashUploadType");
if (cdashUploadFile && cdashUploadType) {
return this->HandleCDashUploadFile(*cdashUploadFile, *cdashUploadType);
if (this->CDashUpload) {
return this->HandleCDashUploadFile(this->CDashUploadFile,
this->CDashUploadType);
}
const std::string& buildDirectory =

View File

@@ -88,4 +88,14 @@ private:
std::set<std::string> Files;
std::vector<std::string> CommandLineHttpHeaders;
std::vector<std::string> HttpHeaders;
bool CDashUpload = false;
bool InternalTest = false;
std::string CDashUploadFile;
std::string CDashUploadType;
std::string RetryCount;
std::string RetryDelay;
friend class cmCTestSubmitCommand;
};