[Cmake-commits] CMake branch, next, updated. v3.2.1-1021-g0a9885a

Bill Hoffman bill.hoffman at kitware.com
Fri Mar 13 20:01:14 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  0a9885ab197a880c0841aeb93841e8744466fa94 (commit)
       via  0b65f7fe6aa3f696ffa4dc9e461873050c15745e (commit)
      from  259cff6357cba8ca026d1fe9dc98002c861b4c3d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a9885ab197a880c0841aeb93841e8744466fa94
commit 0a9885ab197a880c0841aeb93841e8744466fa94
Merge: 259cff6 0b65f7f
Author:     Bill Hoffman <bill.hoffman at kitware.com>
AuthorDate: Fri Mar 13 20:01:08 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Mar 13 20:01:08 2015 -0400

    Merge topic 'add_repeat_testing' into next
    
    0b65f7fe Add error checking to repeat until fail ctest option along with tests.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b65f7fe6aa3f696ffa4dc9e461873050c15745e
commit 0b65f7fe6aa3f696ffa4dc9e461873050c15745e
Author:     Bill Hoffman <bill.hoffman at kitware.com>
AuthorDate: Fri Mar 13 19:58:39 2015 -0400
Commit:     Bill Hoffman <bill.hoffman at kitware.com>
CommitDate: Fri Mar 13 19:58:39 2015 -0400

    Add error checking to repeat until fail ctest option along with tests.

diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 55e2a44..5f094e0 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1985,11 +1985,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;
@@ -2007,11 +2007,25 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
     this->SetParallelLevel(plevel);
     this->ParallelLevelSetInCli = true;
     }
-  if(this->CheckArgument(arg, "--repeat-until-fail") && i < args.size() - 1)
+  if(this->CheckArgument(arg, "--repeat-until-fail"))
     {
+    if( i >= args.size() - 1)
+      {
+      errormsg = "Usage: ctest --repeat-until-fail N";
+      return false;
+      }
     i++;
-    this->RepeatTests = atoi(args[i].c_str());
-    this->RepeatUntilFail = true;
+    long repeat = 1;
+    if(!cmSystemTools::StringToLong(args[i].c_str(), &repeat))
+      {
+      errormsg = "Usage: ctest --repeat-until-fail N";
+      return false;
+      }
+    this->RepeatTests = repeat;
+    if(repeat > 1)
+      {
+      this->RepeatUntilFail = true;
+      }
     }
 
   if(this->CheckArgument(arg, "--no-compress-output"))
@@ -2198,6 +2212,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
     this->GetHandler("test")->SetPersistentOption("RerunFailed", "true");
     this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true");
     }
+  return true;
 }
 
 //----------------------------------------------------------------------
@@ -2280,7 +2295,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);
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 7fd84d8..3f033d9 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -540,8 +540,9 @@ private:
   bool AddVariableDefinition(const std::string &arg);
 
   //! parse and process most common command line arguments
-  void HandleCommandLineArguments(size_t &i,
-                                  std::vector<std::string> &args);
+  bool HandleCommandLineArguments(size_t &i,
+                                  std::vector<std::string> &args,
+                                  std::string& errormsg);
 
   //! hande the -S -SP and -SR arguments
   void HandleScriptArguments(size_t &i,
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index eb42057..ffda31f 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -198,6 +198,7 @@ add_RunCMake_test(CommandLine)
 add_RunCMake_test(install)
 add_RunCMake_test(CPackInstallProperties)
 add_RunCMake_test(ExternalProject)
+add_RunCMake_test(CTestCommandLine)
 
 set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES)
 add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt
new file mode 100644
index 0000000..6610d46
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
+add_test(hello ${CMAKE_COMMAND} -E echo hello)
+add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye)
\ No newline at end of file
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
new file mode 100644
index 0000000..f56db82
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake_command(repeat-until-fail-bad ${CMAKE_CTEST_COMMAND}
+  --repeat-until-fail)
+run_cmake_command(repeat-until-fail-bad2 ${CMAKE_CTEST_COMMAND}
+  --repeat-until-fail foo)
+run_cmake_command(repeat-until-fail-good ${CMAKE_CTEST_COMMAND}
+  --repeat-until-fail 2)
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt
new file mode 100644
index 0000000..723291f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Usage: ctest --repeat-until-fail N
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt
new file mode 100644
index 0000000..723291f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Usage: ctest --repeat-until-fail N
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt
new file mode 100644
index 0000000..eafba1c
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt
@@ -0,0 +1 @@
+No tests were found!!!

-----------------------------------------------------------------------

Summary of changes:
 Source/cmCTest.cxx                                 |   34 ++++++++++++++++----
 Source/cmCTest.h                                   |    5 +--
 Tests/RunCMake/CMakeLists.txt                      |    1 +
 .../CMakeLists.txt                                 |    2 ++
 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake |    8 +++++
 .../repeat-until-fail-bad-result.txt}              |    0
 .../repeat-until-fail-bad-stderr.txt               |    1 +
 .../repeat-until-fail-bad2-result.txt}             |    0
 .../repeat-until-fail-bad2-stderr.txt              |    1 +
 .../repeat-until-fail-good-result.txt}             |    0
 .../repeat-until-fail-good-stderr.txt              |    1 +
 11 files changed, 44 insertions(+), 9 deletions(-)
 copy Tests/RunCMake/{CommandLine => CTestCommandLine}/CMakeLists.txt (50%)
 create mode 100644 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CTestCommandLine/repeat-until-fail-bad-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CTestCommandLine/repeat-until-fail-bad2-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => CTestCommandLine/repeat-until-fail-good-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list