From 8cac63814cd8cdfd982bae934ec30d3ef8ba341f Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Wed, 23 Oct 2024 00:15:59 +0200 Subject: [PATCH] CTestSubmit: Prefer concrete variables over map entries --- Source/CTest/cmCTestSubmitCommand.cxx | 11 ++++++----- Source/CTest/cmCTestSubmitHandler.cxx | 19 +++++++++---------- Source/CTest/cmCTestSubmitHandler.h | 10 ++++++++++ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 0d2501d539..f281c71897 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -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; } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index cf95168fd5..ea98369a90 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -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 = diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 9993e299a2..1711270239 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -88,4 +88,14 @@ private: std::set Files; std::vector CommandLineHttpHeaders; std::vector HttpHeaders; + + bool CDashUpload = false; + bool InternalTest = false; + + std::string CDashUploadFile; + std::string CDashUploadType; + std::string RetryCount; + std::string RetryDelay; + + friend class cmCTestSubmitCommand; };