diff options
author | Brad King <brad.king@kitware.com> | 2019-10-29 18:45:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-10-29 19:10:12 (GMT) |
commit | 80c2c9d14cf1c1a8f162e119bd00d5f483a94af2 (patch) | |
tree | 273a15083c42453ee3265a3ce8263bf7a74a3e3e /Source/CTest/cmCTestRunTest.cxx | |
parent | 0187e522448c8fe92c15d4a983afac36950d1d59 (diff) | |
download | CMake-80c2c9d14cf1c1a8f162e119bd00d5f483a94af2.zip CMake-80c2c9d14cf1c1a8f162e119bd00d5f483a94af2.tar.gz CMake-80c2c9d14cf1c1a8f162e119bd00d5f483a94af2.tar.bz2 |
ctest: Add --repeat-until-pass option
Add an option to re-run tests if they fail. This will help tolerate
sporadic failures.
Issue: #17010
Co-Author: Ben Boeckel <ben.boeckel@kitware.com>
Co-Author: Chuck Atkins <chuck.atkins@kitware.com>
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 2e7836a..ce9e13b 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -340,10 +340,12 @@ bool cmCTestRunTest::NeedsToRerun() return false; } // if number of runs left is not 0, and we are running until - // we find a failed test, then return true so the test can be + // we find a failed (or passed) test, then return true so the test can be // restarted - if (this->RunUntilFail && - this->TestResult.Status == cmCTestTestHandler::COMPLETED) { + if ((this->RerunMode == cmCTest::Rerun::UntilFail && + this->TestResult.Status == cmCTestTestHandler::COMPLETED) || + (this->RerunMode == cmCTest::Rerun::UntilPass && + this->TestResult.Status != cmCTestTestHandler::COMPLETED)) { this->RunAgain = true; return true; } @@ -743,7 +745,11 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) // then it will never print out the completed / total, same would // got for run until pass. Trick is when this is called we don't // yet know if we are passing or failing. - if (this->NumberOfRunsLeft == 1 || this->CTest->GetTestProgressOutput()) { + if ((this->RerunMode != cmCTest::Rerun::UntilPass && + this->NumberOfRunsLeft == 1) || + (this->RerunMode == cmCTest::Rerun::UntilPass && + this->NumberOfRunsLeft == this->NumberOfRunsTotal) || + this->CTest->GetTestProgressOutput()) { outputStream << std::setw(getNumWidth(total)) << completed << "/"; outputStream << std::setw(getNumWidth(total)) << total << " "; } |