summaryrefslogtreecommitdiffstats
path: root/Source/cmCTest.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-23 13:18:26 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-03-23 13:18:26 (GMT)
commitcc8b8cdc751ff2dfa6e77a69da542d6aef066346 (patch)
tree53088db771ef7cebaf89157fe4b081e4417a74b2 /Source/cmCTest.cxx
parentd67196d0e8c5e9feb99d3a609d060f52ad8b9a59 (diff)
parent6bce027662588b972602e2e74c16a1883ed853cf (diff)
downloadCMake-cc8b8cdc751ff2dfa6e77a69da542d6aef066346.zip
CMake-cc8b8cdc751ff2dfa6e77a69da542d6aef066346.tar.gz
CMake-cc8b8cdc751ff2dfa6e77a69da542d6aef066346.tar.bz2
Merge topic 'ctest-repeat-until-fail'
6bce0276 Help: Add notes for topic 'ctest-repeat-until-fail' fde70a1b ctest: Add a new --repeat-until-fail option
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r--Source/cmCTest.cxx37
1 files changed, 33 insertions, 4 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 1d0df69..0026fd7 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -329,6 +329,8 @@ cmCTest::cmCTest()
this->OutputTestOutputOnTestFailure = false;
this->ComputedCompressTestOutput = false;
this->ComputedCompressMemCheckOutput = false;
+ this->RepeatTests = 1; // default to run each test once
+ this->RepeatUntilFail = false;
if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE"))
{
this->OutputTestOutputOnTestFailure = true;
@@ -1984,11 +1986,11 @@ bool cmCTest::CheckArgument(const std::string& arg, const char* varg1,
//----------------------------------------------------------------------
// Processes one command line argument (and its arguments if any)
// for many simple options and then returns
-void cmCTest::HandleCommandLineArguments(size_t &i,
- std::vector<std::string> &args)
+bool cmCTest::HandleCommandLineArguments(size_t &i,
+ std::vector<std::string> &args,
+ std::string& errormsg)
{
std::string arg = args[i];
-
if(this->CheckArgument(arg, "-F"))
{
this->Failover = true;
@@ -2006,6 +2008,27 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
this->SetParallelLevel(plevel);
this->ParallelLevelSetInCli = true;
}
+ if(this->CheckArgument(arg, "--repeat-until-fail"))
+ {
+ if( i >= args.size() - 1)
+ {
+ errormsg = "'--repeat-until-fail' requires an argument";
+ return false;
+ }
+ i++;
+ long repeat = 1;
+ if(!cmSystemTools::StringToLong(args[i].c_str(), &repeat))
+ {
+ errormsg = "'--repeat-until-fail' given non-integer value '"
+ + args[i] + "'";
+ return false;
+ }
+ this->RepeatTests = static_cast<int>(repeat);
+ if(repeat > 1)
+ {
+ this->RepeatUntilFail = true;
+ }
+ }
if(this->CheckArgument(arg, "--no-compress-output"))
{
@@ -2191,6 +2214,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
this->GetHandler("test")->SetPersistentOption("RerunFailed", "true");
this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true");
}
+ return true;
}
//----------------------------------------------------------------------
@@ -2273,7 +2297,12 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output)
for(size_t i=1; i < args.size(); ++i)
{
// handle the simple commandline arguments
- this->HandleCommandLineArguments(i,args);
+ std::string errormsg;
+ if(!this->HandleCommandLineArguments(i,args, errormsg))
+ {
+ cmSystemTools::Error(errormsg.c_str());
+ return 1;
+ }
// handle the script arguments -S -SR -SP
this->HandleScriptArguments(i,args,SRArgumentSpecified);