Merge topic 'no-stringly-typed-variables' 5497eba1a0 CTestUpdate: Prefer concrete variables over map entries 8cac63814c CTestSubmit: Prefer concrete variables over map entries Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9935
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index b3ede45..2d6d996 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -164,15 +164,16 @@ 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 0ce32b8..3b3baa9 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -283,7 +283,7 @@ upload_as += "&MD5="; - if (this->GetOption("InternalTest").IsOn()) { + if (this->InternalTest) { upload_as += "ffffffffffffffffffffffffffffffff"; } else { cmCryptoHash hasher(cmCryptoHash::AlgoMD5); @@ -365,8 +365,8 @@ 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() @@ -525,11 +525,11 @@ 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; @@ -718,10 +718,9 @@ 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 6bc32de..cbfa44d 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -88,4 +88,14 @@ 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; };
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 34df7bd..cb3ee26 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -79,7 +79,7 @@ this->SetError("source directory not specified. Please use SOURCE tag"); return nullptr; } - handler->SetOption("SourceDirectory", source_dir); + handler->SourceDirectory = source_dir; handler->SetQuiet(this->Quiet); return handler; }
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 27fe6da..f8b93b3 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -19,7 +19,6 @@ #include "cmGeneratedFileStream.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cmValue.h" #include "cmVersion.h" #include "cmXMLWriter.h" @@ -109,8 +108,7 @@ static_cast<void>(fixLocale); // Get source dir - cmValue sourceDirectory = this->GetOption("SourceDirectory"); - if (!sourceDirectory) { + if (this->SourceDirectory.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find SourceDirectory key in the DartConfiguration.tcl" << std::endl); @@ -123,7 +121,7 @@ } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Updating the repository: " << *sourceDirectory + " Updating the repository: " << this->SourceDirectory << std::endl, this->Quiet); @@ -163,7 +161,7 @@ break; } vc->SetCommandLineTool(this->UpdateCommand); - vc->SetSourceDirectory(*sourceDirectory); + vc->SetSourceDirectory(this->SourceDirectory); // Cleanup the working tree. vc->Cleanup(); @@ -301,7 +299,7 @@ this->UpdateCommand = this->CTest->GetCTestConfiguration("UpdateCommand"); // Detect the VCS managing the source tree. - this->UpdateType = this->DetectVCS(this->GetOption("SourceDirectory")); + this->UpdateType = this->DetectVCS(this->SourceDirectory); if (this->UpdateType == e_UNKNOWN) { // The source tree does not have a recognized VCS. Check the // configuration value or command name.
diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index 4935232..2424761 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h
@@ -59,8 +59,11 @@ // The VCS command to update the working tree. std::string UpdateCommand; + std::string SourceDirectory; int UpdateType; int DetectVCS(const std::string& dir); bool SelectVCS(); + + friend class cmCTestUpdateCommand; };