[cmake-commits] martink committed cmCTestBuildHandler.cxx 1.48 1.49 cmCTestCoverageHandler.cxx 1.34 1.35 cmCTestScriptHandler.cxx 1.36 1.37 cmCTestScriptHandler.h 1.17 1.18 cmCTestTestHandler.cxx 1.49 1.50

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Oct 19 10:45:26 EDT 2006


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

Modified Files:
	cmCTestBuildHandler.cxx cmCTestCoverageHandler.cxx 
	cmCTestScriptHandler.cxx cmCTestScriptHandler.h 
	cmCTestTestHandler.cxx 
Log Message:
ENH: added total time limit for a CTest run bug 1207


Index: cmCTestCoverageHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestCoverageHandler.cxx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cmCTestCoverageHandler.cxx	15 Oct 2006 11:54:52 -0000	1.34
+++ cmCTestCoverageHandler.cxx	19 Oct 2006 14:45:19 -0000	1.35
@@ -180,6 +180,12 @@
 {
   int error = 0;
 
+  // do we have time for this
+  if (this->CTest->GetRemainingTimeAllowed() < 120)
+    {
+    return error;
+    }
+  
   std::string sourceDir
     = this->CTest->GetCTestConfiguration("SourceDirectory");
   std::string binaryDir

Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- cmCTestTestHandler.cxx	13 Oct 2006 13:30:30 -0000	1.49
+++ cmCTestTestHandler.cxx	19 Oct 2006 14:45:19 -0000	1.50
@@ -605,6 +605,14 @@
       {
       inREcnt++;
       }
+
+    // if we are out of time then skip this test, we leave two minutes 
+    // to submit results
+    if (this->CTest->GetRemainingTimeAllowed() - 120 <= 0)
+      {
+      continue;
+      }
+
     const std::string& testname = it->Name;
     std::vector<std::string>& args = it->Args;
     cmCTestTestResult cres;

Index: cmCTestBuildHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildHandler.cxx,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- cmCTestBuildHandler.cxx	12 Oct 2006 18:47:40 -0000	1.48
+++ cmCTestBuildHandler.cxx	19 Oct 2006 14:45:19 -0000	1.49
@@ -250,6 +250,12 @@
 {
   cmCTestLog(this->CTest, HANDLER_OUTPUT, "Build project" << std::endl);
 
+  // do we have time for this
+  if (this->CTest->GetRemainingTimeAllowed() < 120)
+    {
+    return 0;
+    }
+
   int entry;
   for ( entry = 0;
     cmCTestWarningErrorFileLine[entry].RegularExpressionString;

Index: cmCTestScriptHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestScriptHandler.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cmCTestScriptHandler.h	30 Apr 2006 00:13:05 -0000	1.17
+++ cmCTestScriptHandler.h	19 Oct 2006 14:45:19 -0000	1.18
@@ -96,6 +96,13 @@
   static void SleepInSeconds(unsigned int secondsToWait);
   void UpdateElapsedTime();
 
+  /** 
+   * Return the time remaianing that the script is allowed to run in
+   * seconds if the user has set the variable CTEST_TIME_LIMIT. If that has
+   * not been set it returns 1e7 seconds
+   */
+  double GetRemainingTimeAllowed();
+
   cmCTestScriptHandler();
   ~cmCTestScriptHandler();
 

Index: cmCTestScriptHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestScriptHandler.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- cmCTestScriptHandler.cxx	12 Oct 2006 19:10:21 -0000	1.36
+++ cmCTestScriptHandler.cxx	19 Oct 2006 14:45:19 -0000	1.37
@@ -965,3 +965,24 @@
     }
   return true;
 }
+
+//-------------------------------------------------------------------------
+double cmCTestScriptHandler::GetRemainingTimeAllowed()
+{
+  if (!this->Makefile)
+    {
+    return 1.0e7;
+    }
+
+  const char *timelimitS
+    = this->Makefile->GetDefinition("CTEST_TIME_LIMIT");
+  
+  if (!timelimitS)
+    {
+    return 1.0e7;
+    }
+
+  double timelimit = atof(timelimitS);
+  
+  return timelimit - cmSystemTools::GetTime() + this->ScriptStartTime;
+}



More information about the Cmake-commits mailing list