Browse Source

cmCTestRunTest: do not count skipped tests as failed

Skipped tests are neither passed nor failed tests, but return codes are
based only upon failed tests, so do not count them as such.

Fixes #16822.
Ben Boeckel 8 years ago
parent
commit
202a44a4ca
1 changed files with 6 additions and 2 deletions
  1. 6 2
      Source/CTest/cmCTestRunTest.cxx

+ 6 - 2
Source/CTest/cmCTestRunTest.cxx

@@ -167,6 +167,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
   std::vector<std::pair<cmsys::RegularExpression, std::string> >::iterator
   std::vector<std::pair<cmsys::RegularExpression, std::string> >::iterator
     passIt;
     passIt;
   bool forceFail = false;
   bool forceFail = false;
+  bool skipped = false;
   bool outputTestErrorsToConsole = false;
   bool outputTestErrorsToConsole = false;
   if (!this->TestProperties->RequiredRegularExpressions.empty() &&
   if (!this->TestProperties->RequiredRegularExpressions.empty() &&
       this->FailedDependencies.empty()) {
       this->FailedDependencies.empty()) {
@@ -219,6 +220,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
       s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode;
       s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode;
       this->TestResult.CompletionStatus = s.str();
       this->TestResult.CompletionStatus = s.str();
       cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped ");
       cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped ");
+      skipped = true;
     } else if ((success && !this->TestProperties->WillFail) ||
     } else if ((success && !this->TestProperties->WillFail) ||
                (!success && this->TestProperties->WillFail)) {
                (!success && this->TestProperties->WillFail)) {
       this->TestResult.Status = cmCTestTestHandler::COMPLETED;
       this->TestResult.Status = cmCTestTestHandler::COMPLETED;
@@ -338,7 +340,9 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
       compress ? this->CompressedOutput : this->ProcessOutput;
       compress ? this->CompressedOutput : this->ProcessOutput;
     this->TestResult.CompressOutput = compress;
     this->TestResult.CompressOutput = compress;
     this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
     this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
-    this->TestResult.CompletionStatus = "Completed";
+    if (!skipped) {
+      this->TestResult.CompletionStatus = "Completed";
+    }
     this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
     this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
     this->MemCheckPostProcess();
     this->MemCheckPostProcess();
     this->ComputeWeightedCost();
     this->ComputeWeightedCost();
@@ -349,7 +353,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
     this->TestHandler->TestResults.push_back(this->TestResult);
     this->TestHandler->TestResults.push_back(this->TestResult);
   }
   }
   delete this->TestProcess;
   delete this->TestProcess;
-  return passed;
+  return passed || skipped;
 }
 }
 
 
 bool cmCTestRunTest::StartAgain()
 bool cmCTestRunTest::StartAgain()