diff options
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r-- | Source/cmCTest.cxx | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 6eae26e..34e9479 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -84,7 +84,7 @@ struct cmCTest::Private }; int RepeatTests = 1; // default to run each test once - bool RepeatUntilFail = false; + cmCTest::Rerun RerunMode = cmCTest::Rerun::Never; std::string ConfigType; std::string ScheduleType; std::chrono::system_clock::time_point StopTime; @@ -1839,11 +1839,16 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, this->SetParallelLevel(plevel); this->Impl->ParallelLevelSetInCli = true; } + if (this->CheckArgument(arg, "--repeat-until-fail")) { if (i >= args.size() - 1) { errormsg = "'--repeat-until-fail' requires an argument"; return false; } + if (this->Impl->RerunMode != cmCTest::Rerun::Never) { + errormsg = "At most one '--repeat-*' option may be used."; + return false; + } i++; long repeat = 1; if (!cmStrToLong(args[i], &repeat)) { @@ -1853,7 +1858,51 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, } this->Impl->RepeatTests = static_cast<int>(repeat); if (repeat > 1) { - this->Impl->RepeatUntilFail = true; + this->Impl->RerunMode = cmCTest::Rerun::UntilFail; + } + } + + if (this->CheckArgument(arg, "--repeat-until-pass")) { + if (i >= args.size() - 1) { + errormsg = "'--repeat-until-pass' requires an argument"; + return false; + } + if (this->Impl->RerunMode != cmCTest::Rerun::Never) { + errormsg = "At most one '--repeat-*' option may be used."; + return false; + } + i++; + long repeat = 1; + if (!cmStrToLong(args[i], &repeat)) { + errormsg = + "'--repeat-until-pass' given non-integer value '" + args[i] + "'"; + return false; + } + this->Impl->RepeatTests = static_cast<int>(repeat); + if (repeat > 1) { + this->Impl->RerunMode = cmCTest::Rerun::UntilPass; + } + } + + if (this->CheckArgument(arg, "--repeat-after-timeout")) { + if (i >= args.size() - 1) { + errormsg = "'--repeat-after-timeout' requires an argument"; + return false; + } + if (this->Impl->RerunMode != cmCTest::Rerun::Never) { + errormsg = "At most one '--repeat-*' option may be used."; + return false; + } + i++; + long repeat = 1; + if (!cmStrToLong(args[i], &repeat)) { + errormsg = + "'--repeat-after-timeout' given non-integer value '" + args[i] + "'"; + return false; + } + this->Impl->RepeatTests = static_cast<int>(repeat); + if (repeat > 1) { + this->Impl->RerunMode = cmCTest::Rerun::AfterTimeout; } } @@ -2852,9 +2901,9 @@ int cmCTest::GetTestRepeat() const return this->Impl->RepeatTests; } -bool cmCTest::GetRepeatUntilFail() const +cmCTest::Rerun cmCTest::GetRerunMode() const { - return this->Impl->RepeatUntilFail; + return this->Impl->RerunMode; } void cmCTest::SetBuildID(const std::string& id) |