瀏覽代碼

CTest: Rename internal APIs for --repeat options

Replace use of the term "rerun" with "repeat" to match the public names.
Brad King 6 年之前
父節點
當前提交
ed65b3e984
共有 5 個文件被更改,包括 31 次插入31 次删除
  1. 3 3
      Source/CTest/cmCTestMultiProcessHandler.cxx
  2. 7 7
      Source/CTest/cmCTestRunTest.cxx
  3. 3 3
      Source/CTest/cmCTestRunTest.h
  4. 15 15
      Source/cmCTest.cxx
  5. 3 3
      Source/cmCTest.h

+ 3 - 3
Source/CTest/cmCTestMultiProcessHandler.cxx

@@ -171,9 +171,9 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test)
   this->RunningCount += GetProcessorsUsed(test);
 
   cmCTestRunTest* testRun = new cmCTestRunTest(*this);
-  if (this->CTest->GetRerunMode() != cmCTest::Rerun::Never) {
-    testRun->SetRerunMode(this->CTest->GetRerunMode());
-    testRun->SetNumberOfRuns(this->CTest->GetTestRepeat());
+  if (this->CTest->GetRepeatMode() != cmCTest::Repeat::Never) {
+    testRun->SetRepeatMode(this->CTest->GetRepeatMode());
+    testRun->SetNumberOfRuns(this->CTest->GetRepeatCount());
   }
   testRun->SetIndex(test);
   testRun->SetTestProperties(this->Properties[test]);

+ 7 - 7
Source/CTest/cmCTestRunTest.cxx

@@ -307,7 +307,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
   }
   // If the test does not need to rerun push the current TestResult onto the
   // TestHandler vector
-  if (!this->NeedsToRerun()) {
+  if (!this->NeedsToRepeat()) {
     this->TestHandler->TestResults.push_back(this->TestResult);
   }
   this->TestProcess.reset();
@@ -333,7 +333,7 @@ bool cmCTestRunTest::StartAgain(size_t completed)
   return true;
 }
 
-bool cmCTestRunTest::NeedsToRerun()
+bool cmCTestRunTest::NeedsToRepeat()
 {
   this->NumberOfRunsLeft--;
   if (this->NumberOfRunsLeft == 0) {
@@ -342,11 +342,11 @@ bool cmCTestRunTest::NeedsToRerun()
   // if number of runs left is not 0, and we are running until
   // we find a failed (or passed) test, then return true so the test can be
   // restarted
-  if ((this->RerunMode == cmCTest::Rerun::UntilFail &&
+  if ((this->RepeatMode == cmCTest::Repeat::UntilFail &&
        this->TestResult.Status == cmCTestTestHandler::COMPLETED) ||
-      (this->RerunMode == cmCTest::Rerun::UntilPass &&
+      (this->RepeatMode == cmCTest::Repeat::UntilPass &&
        this->TestResult.Status != cmCTestTestHandler::COMPLETED) ||
-      (this->RerunMode == cmCTest::Rerun::AfterTimeout &&
+      (this->RepeatMode == cmCTest::Repeat::AfterTimeout &&
        this->TestResult.Status == cmCTestTestHandler::TIMEOUT)) {
     this->RunAgain = true;
     return true;
@@ -748,8 +748,8 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
   // got for run until pass.  Trick is when this is called we don't
   // yet know if we are passing or failing.
   bool const progressOnLast =
-    (this->RerunMode != cmCTest::Rerun::UntilPass &&
-     this->RerunMode != cmCTest::Rerun::AfterTimeout);
+    (this->RepeatMode != cmCTest::Repeat::UntilPass &&
+     this->RepeatMode != cmCTest::Repeat::AfterTimeout);
   if ((progressOnLast && this->NumberOfRunsLeft == 1) ||
       (!progressOnLast && this->NumberOfRunsLeft == this->NumberOfRunsTotal) ||
       this->CTest->GetTestProgressOutput()) {

+ 3 - 3
Source/CTest/cmCTestRunTest.h

@@ -35,7 +35,7 @@ public:
     this->NumberOfRunsTotal = n;
   }
 
-  void SetRerunMode(cmCTest::Rerun r) { this->RerunMode = r; }
+  void SetRepeatMode(cmCTest::Repeat r) { this->RepeatMode = r; }
   void SetTestProperties(cmCTestTestHandler::cmCTestTestProperties* prop)
   {
     this->TestProperties = prop;
@@ -102,7 +102,7 @@ public:
   }
 
 private:
-  bool NeedsToRerun();
+  bool NeedsToRepeat();
   void DartProcessing();
   void ExeNotFound(std::string exe);
   bool ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
@@ -136,7 +136,7 @@ private:
   std::vector<std::map<
     std::string, std::vector<cmCTestMultiProcessHandler::ResourceAllocation>>>
     AllocatedResources;
-  cmCTest::Rerun RerunMode = cmCTest::Rerun::Never;
+  cmCTest::Repeat RepeatMode = cmCTest::Repeat::Never;
   int NumberOfRunsLeft = 1;  // default to 1 run of the test
   int NumberOfRunsTotal = 1; // default to 1 run of the test
   bool RunAgain = false;     // default to not having to run again

+ 15 - 15
Source/cmCTest.cxx

@@ -83,8 +83,8 @@ struct cmCTest::Private
     std::string Name;
   };
 
-  int RepeatTests = 1; // default to run each test once
-  cmCTest::Rerun RerunMode = cmCTest::Rerun::Never;
+  int RepeatCount = 1; // default to run each test once
+  cmCTest::Repeat RepeatMode = cmCTest::Repeat::Never;
   std::string ConfigType;
   std::string ScheduleType;
   std::chrono::system_clock::time_point StopTime;
@@ -1845,7 +1845,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
       errormsg = "'--repeat-until-fail' requires an argument";
       return false;
     }
-    if (this->Impl->RerunMode != cmCTest::Rerun::Never) {
+    if (this->Impl->RepeatMode != cmCTest::Repeat::Never) {
       errormsg = "At most one '--repeat-*' option may be used.";
       return false;
     }
@@ -1856,9 +1856,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
         "'--repeat-until-fail' given non-integer value '" + args[i] + "'";
       return false;
     }
-    this->Impl->RepeatTests = static_cast<int>(repeat);
+    this->Impl->RepeatCount = static_cast<int>(repeat);
     if (repeat > 1) {
-      this->Impl->RerunMode = cmCTest::Rerun::UntilFail;
+      this->Impl->RepeatMode = cmCTest::Repeat::UntilFail;
     }
   }
 
@@ -1867,7 +1867,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
       errormsg = "'--repeat-until-pass' requires an argument";
       return false;
     }
-    if (this->Impl->RerunMode != cmCTest::Rerun::Never) {
+    if (this->Impl->RepeatMode != cmCTest::Repeat::Never) {
       errormsg = "At most one '--repeat-*' option may be used.";
       return false;
     }
@@ -1878,9 +1878,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
         "'--repeat-until-pass' given non-integer value '" + args[i] + "'";
       return false;
     }
-    this->Impl->RepeatTests = static_cast<int>(repeat);
+    this->Impl->RepeatCount = static_cast<int>(repeat);
     if (repeat > 1) {
-      this->Impl->RerunMode = cmCTest::Rerun::UntilPass;
+      this->Impl->RepeatMode = cmCTest::Repeat::UntilPass;
     }
   }
 
@@ -1889,7 +1889,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
       errormsg = "'--repeat-after-timeout' requires an argument";
       return false;
     }
-    if (this->Impl->RerunMode != cmCTest::Rerun::Never) {
+    if (this->Impl->RepeatMode != cmCTest::Repeat::Never) {
       errormsg = "At most one '--repeat-*' option may be used.";
       return false;
     }
@@ -1900,9 +1900,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
         "'--repeat-after-timeout' given non-integer value '" + args[i] + "'";
       return false;
     }
-    this->Impl->RepeatTests = static_cast<int>(repeat);
+    this->Impl->RepeatCount = static_cast<int>(repeat);
     if (repeat > 1) {
-      this->Impl->RerunMode = cmCTest::Rerun::AfterTimeout;
+      this->Impl->RepeatMode = cmCTest::Repeat::AfterTimeout;
     }
   }
 
@@ -2896,14 +2896,14 @@ const std::map<std::string, std::string>& cmCTest::GetDefinitions() const
   return this->Impl->Definitions;
 }
 
-int cmCTest::GetTestRepeat() const
+int cmCTest::GetRepeatCount() const
 {
-  return this->Impl->RepeatTests;
+  return this->Impl->RepeatCount;
 }
 
-cmCTest::Rerun cmCTest::GetRerunMode() const
+cmCTest::Repeat cmCTest::GetRepeatMode() const
 {
-  return this->Impl->RerunMode;
+  return this->Impl->RepeatMode;
 }
 
 void cmCTest::SetBuildID(const std::string& id)

+ 3 - 3
Source/cmCTest.h

@@ -431,16 +431,16 @@ public:
   const std::map<std::string, std::string>& GetDefinitions() const;
 
   /** Return the number of times a test should be run */
-  int GetTestRepeat() const;
+  int GetRepeatCount() const;
 
-  enum class Rerun
+  enum class Repeat
   {
     Never,
     UntilFail,
     UntilPass,
     AfterTimeout,
   };
-  Rerun GetRerunMode() const;
+  Repeat GetRepeatMode() const;
 
   void GenerateSubprojectsOutput(cmXMLWriter& xml);
   std::vector<std::string> GetLabelsForSubprojects();