Forráskód Böngészése

CTestSubmit: Prefer concrete variables over map entries

Daniel Pfeifer 1 éve
szülő
commit
8cac63814c

+ 6 - 5
Source/CTest/cmCTestSubmitCommand.cxx

@@ -164,15 +164,16 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
     handler->SetHttpHeaders(this->HttpHeaders);
     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);
   handler->SetQuiet(this->Quiet);
 
 
   if (this->CDashUpload) {
   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;
   return handler;
 }
 }

+ 9 - 10
Source/CTest/cmCTestSubmitHandler.cxx

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

+ 10 - 0
Source/CTest/cmCTestSubmitHandler.h

@@ -88,4 +88,14 @@ private:
   std::set<std::string> Files;
   std::set<std::string> Files;
   std::vector<std::string> CommandLineHttpHeaders;
   std::vector<std::string> CommandLineHttpHeaders;
   std::vector<std::string> HttpHeaders;
   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;
 };
 };