[cmake-commits] martink committed cmCTest.cxx 1.313 1.314 cmCTest.h 1.96 1.97 cmTest.cxx 1.6 1.7 ctest.cxx 1.91 1.92

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Jan 25 11:16:18 EST 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv4136/Source

Modified Files:
	cmCTest.cxx cmCTest.h cmTest.cxx ctest.cxx 
Log Message:
ENH: added per test timeout support


Index: cmCTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.h,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- cmCTest.h	19 Oct 2006 14:45:18 -0000	1.96
+++ cmCTest.h	25 Jan 2007 16:16:15 -0000	1.97
@@ -232,7 +232,7 @@
   //! Run command specialized for tests. Returns process status and retVal is
   // return value or exception.
   int RunTest(std::vector<const char*> args, std::string* output, int *retVal,
-    std::ostream* logfile);
+    std::ostream* logfile, double testTimeOut);
 
   /**
    * Execute handler and return its result. If the handler fails, it returns

Index: cmCTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.cxx,v
retrieving revision 1.313
retrieving revision 1.314
diff -u -d -r1.313 -r1.314
--- cmCTest.cxx	4 Dec 2006 22:26:38 -0000	1.313
+++ cmCTest.cxx	25 Jan 2007 16:16:15 -0000	1.314
@@ -1074,7 +1074,7 @@
 //----------------------------------------------------------------------
 int cmCTest::RunTest(std::vector<const char*> argv,
                      std::string* output, int *retVal,
-                     std::ostream* log)
+                     std::ostream* log, double testTimeOut)
 {
   if(cmSystemTools::SameFile(argv[0], this->CTestSelf.c_str()) &&
      !this->ForceNewCTestProcess)
@@ -1087,6 +1087,14 @@
       {
       if(argv[i])
         {
+        // if this test has a test command make sure we pass the timeout in
+        if (strcmp(argv[i],"--test-command") == 0 && testTimeOut)
+          {
+          args.push_back("--test-timeout");
+          cmOStringStream msg;
+          msg << testTimeOut;
+          args.push_back(msg.str());
+          }
         args.push_back(argv[i]);
         }
       }
@@ -1128,6 +1136,12 @@
     {
     timeout = this->TimeOut;
     }
+  cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "-- timeout set to "
+             << testTimeOut << std::endl);
+  if (testTimeOut && testTimeOut < timeout)
+    {
+    timeout = testTimeOut;
+    }
   // always have at least 1 second if we got to here
   if (timeout <= 0)
     {

Index: cmTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTest.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cmTest.cxx	7 Dec 2006 15:22:19 -0000	1.6
+++ cmTest.cxx	25 Jan 2007 16:16:16 -0000	1.7
@@ -118,6 +118,15 @@
      " regular expressions has to match, otherwise the test will fail.");
 
   cm->DefineProperty
+    ("TIMEOUT", cmProperty::TEST, 
+     "How many seconds to allow for this test.",
+     "This property if set will limit a test to nto take more than "
+     "the specified number of seconds to run. If it exceeds that the "
+     "test process will be killed and ctest will move to the next test. "
+     "This setting takes precedence over DART_TESTING_TIMEOUT and "
+     "CTEST_TESTING_TIMOUT.");
+
+  cm->DefineProperty
     ("WILL_FAIL", cmProperty::TEST, 
      "If set to true, this will invert the pass/fail flag of the test.",
      "This property can be used for tests that are expected to fail and "

Index: ctest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/ctest.cxx,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- ctest.cxx	28 Apr 2006 15:59:31 -0000	1.91
+++ ctest.cxx	25 Jan 2007 16:16:16 -0000	1.92
@@ -148,7 +148,7 @@
    "complete. Other options that affect this mode are --build-target "
    "--build-nocmake, --build-run-dir, "
    "--build-two-config, --build-exe-dir, --build-project,"
-   "--build-noclean, --build-options"},
+   "--build-noclean, --build-options, --test-timeout"},
   {"--build-target", "Specify a specific target to build.",
    "This option goes with the --build-and-test option, if left out the all "
    "target is built." },
@@ -168,6 +168,8 @@
 
   {"--test-command", "The test to run with the --build-and-test option.", ""
   },
+  {"--test-timeout", "The time limit in seconds for --test-command.", ""
+  },
   {"--tomorrow-tag", "Nightly or experimental starts with next day tag.",
    "This is useful if the build will not finish in one day." },
   {"--ctest-config", "The configuration file used to initialize CTest state "



More information about the Cmake-commits mailing list