[Cmake-commits] CMake branch, next, updated. v3.3.0-rc2-648-gb2ba8a9

Brad King brad.king at kitware.com
Wed Jun 24 11:14:17 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  b2ba8a917d2d89ad5c43c855d510e9e39b7e7e0a (commit)
       via  62962cff865d4c8656609d59a41252ece2846c9f (commit)
       via  308bc4145198d6ae54c09d1be24f40aefe11804e (commit)
       via  f095fdbba2509ad886c1713e1b286bc774726125 (commit)
      from  7797c9c97b63e8e7ad7de9ad6f6ab995f9c1ddcf (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=b2ba8a917d2d89ad5c43c855d510e9e39b7e7e0a
commit b2ba8a917d2d89ad5c43c855d510e9e39b7e7e0a
Merge: 7797c9c 62962cf
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 24 11:14:16 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jun 24 11:14:16 2015 -0400

    Merge topic 'ctest-test-load' into next
    
    62962cff fixup! ctest: Optionally avoid starting tests that may exceed a given CPU load
    308bc414 Tests: Teach RunCMake infrastructure to optionally timeout
    f095fdbb cmSystemTools: Add StringToULong helper


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=62962cff865d4c8656609d59a41252ece2846c9f
commit 62962cff865d4c8656609d59a41252ece2846c9f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 24 10:06:48 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jun 24 10:50:44 2015 -0400

    fixup! ctest: Optionally avoid starting tests that may exceed a given CPU load

diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index b2264cc..4b7ae79 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -89,8 +89,8 @@ public:
   void SetAppendXML(bool b) { this->AppendXML = b; }
   void SetQuiet(bool b) { this->Quiet = b; }
   bool GetQuiet() { return this->Quiet; }
-  void SetTestLoad(long load) { this->TestLoad = load; }
-  long GetTestLoad() const { return this->TestLoad;  }
+  void SetTestLoad(unsigned long load) { this->TestLoad = load; }
+  unsigned long GetTestLoad() const { return this->TestLoad;  }
 
 protected:
   bool StartResultingXML(cmCTest::Part part,
@@ -99,7 +99,7 @@ protected:
 
   bool AppendXML;
   bool Quiet;
-  long TestLoad;
+  unsigned long TestLoad;
   cmSystemTools::OutputOption HandlerVerbose;
   cmCTest *CTest;
   t_StringToString Options;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index ba44015..4832186 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -19,6 +19,7 @@
 #include <stack>
 #include <list>
 #include <float.h>
+#include <math.h>
 #include <cmsys/FStream.hxx>
 #include <cmsys/SystemInformation.hxx>
 
@@ -87,9 +88,9 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level)
   this->ParallelLevel = level < 1 ? 1 : level;
 }
 
-void cmCTestMultiProcessHandler::SetTestLoad(long load)
+void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load)
 {
-  this->TestLoad = load < 0 ? 0 : load;
+  this->TestLoad = load;
 }
 
 //---------------------------------------------------------
@@ -278,12 +279,39 @@ void cmCTestMultiProcessHandler::StartNextTests()
   std::string testWithMinProcessors = "";
 
   cmsys::SystemInformation info;
+
+  unsigned long systemLoad = 0;
+  size_t spareLoad = 0;
   if (this->TestLoad > 0)
     {
+    // Activate possible wait.
     allTestsFailedTestLoadCheck = true;
-    }
 
-  double systemLoad = 0.0;
+    // Check for a fake load average value used in testing.
+    if (const char* fake_load_value =
+        cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING"))
+      {
+      usedFakeLoadForTesting = true;
+      if (!cmSystemTools::StringToULong(fake_load_value, &systemLoad))
+        {
+        cmSystemTools::Error("Failed to parse fake load value: ",
+                             fake_load_value);
+        }
+      }
+    // If it's not set, look up the true load average.
+    else
+      {
+      systemLoad = static_cast<unsigned long>(ceil(info.GetLoadAverage()));
+      }
+    spareLoad = (this->TestLoad > systemLoad ?
+                 this->TestLoad - systemLoad : 0);
+
+    // Don't start more tests than the spare load can support.
+    if (numToStart > spareLoad)
+      {
+      numToStart = spareLoad;
+      }
+    }
 
   TestList copy = this->SortedTests;
   for(TestList::iterator test = copy.begin(); test != copy.end(); ++test)
@@ -291,7 +319,6 @@ void cmCTestMultiProcessHandler::StartNextTests()
     // Take a nap if we're currently performing a RUN_SERIAL test.
     if (this->SerialTestRunning)
       {
-      allTestsFailedTestLoadCheck = true;
       break;
       }
     // We can only start a RUN_SERIAL test if no other tests are also running.
@@ -301,30 +328,10 @@ void cmCTestMultiProcessHandler::StartNextTests()
       }
 
     size_t processors = GetProcessorsUsed(*test);
-    bool testLoadOk;
+    bool testLoadOk = true;
     if (this->TestLoad > 0)
       {
-      // Check for a fake load average value used in testing.
-      if (const char* fake_load_value =
-          cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING"))
-        {
-        usedFakeLoadForTesting = true;
-        systemLoad = atoi(fake_load_value);
-        }
-      // If it's not set, look up the true load average.
-      else
-        {
-        systemLoad = info.GetLoadAverage();
-        }
-
-      // Don't start more tests than your max load can support.
-      if (numToStart > (this->TestLoad - systemLoad))
-        {
-        numToStart = this->TestLoad - systemLoad;
-        }
-
-      testLoadOk = processors <= (this->TestLoad - systemLoad);
-      if (testLoadOk)
+      if (processors <= spareLoad)
         {
         cmCTestLog(this->CTest, DEBUG,
                     "OK to run " << GetName(*test) <<
@@ -333,10 +340,10 @@ void cmCTestMultiProcessHandler::StartNextTests()
                     systemLoad << std::endl);
         allTestsFailedTestLoadCheck = false;
         }
-      }
-    else
-      {
-      testLoadOk = true;
+      else
+        {
+        testLoadOk = false;
+        }
       }
 
     if (processors <= minProcessorsRequired)
@@ -356,7 +363,7 @@ void cmCTestMultiProcessHandler::StartNextTests()
       }
     else if(numToStart == 0)
       {
-      return;
+      break;
       }
     }
 
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 68fd7ad..ed3e155 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -37,7 +37,7 @@ public:
   void SetTests(TestMap& tests, PropertiesMap& properties);
   // Set the max number of tests that can be run at the same time.
   void SetParallelLevel(size_t);
-  void SetTestLoad(long load);
+  void SetTestLoad(unsigned long load);
   virtual void RunTests();
   void PrintTestList();
   void PrintLabels();
@@ -118,7 +118,7 @@ protected:
   std::set<std::string> LockedResources;
   std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
   size_t ParallelLevel; // max number of process that can be run at once
-  long TestLoad;
+  unsigned long TestLoad;
   std::set<cmCTestRunTest*> RunningTests;  // current running tests
   cmCTestTestHandler * TestHandler;
   cmCTest* CTest;
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 4058eb0..b7d8318 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -108,12 +108,12 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
   // Test load is determined by: TEST_LOAD argument,
   // or CTEST_TEST_LOAD script variable, or ctest --test-load
   // command line argument... in that order.
-  long testLoad;
+  unsigned long testLoad;
   const char* ctestTestLoad
     = this->Makefile->GetDefinition("CTEST_TEST_LOAD");
   if(this->Values[ctt_TEST_LOAD] && *this->Values[ctt_TEST_LOAD])
     {
-    if (!cmSystemTools::StringToLong(this->Values[ctt_TEST_LOAD], &testLoad))
+    if (!cmSystemTools::StringToULong(this->Values[ctt_TEST_LOAD], &testLoad))
       {
       testLoad = 0;
       cmCTestLog(this->CTest, WARNING, "Invalid value for 'TEST_LOAD' : "
@@ -122,7 +122,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
     }
   else if(ctestTestLoad && *ctestTestLoad)
     {
-    if (!cmSystemTools::StringToLong(ctestTestLoad, &testLoad))
+    if (!cmSystemTools::StringToULong(ctestTestLoad, &testLoad))
       {
       testLoad = 0;
       cmCTestLog(this->CTest, WARNING,
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 86ce4c7..5887ba8 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -394,9 +394,9 @@ void cmCTest::SetParallelLevel(int level)
   this->ParallelLevel = level < 1 ? 1 : level;
 }
 
-void cmCTest::SetTestLoad(long load)
+void cmCTest::SetTestLoad(unsigned long load)
 {
-  this->TestLoad = load < 0 ? 0 : load;
+  this->TestLoad = load;
 }
 
 //----------------------------------------------------------------------------
@@ -829,8 +829,8 @@ bool cmCTest::UpdateCTestConfiguration()
   std::string const& testLoad = this->GetCTestConfiguration("TestLoad");
   if (!testLoad.empty())
     {
-    long load;
-    if (cmSystemTools::StringToLong(testLoad.c_str(), &load))
+    unsigned long load;
+    if (cmSystemTools::StringToULong(testLoad.c_str(), &load))
       {
       this->SetTestLoad(load);
       }
@@ -2074,8 +2074,8 @@ bool cmCTest::HandleCommandLineArguments(size_t &i,
   if(this->CheckArgument(arg, "--test-load") && i < args.size() - 1)
     {
     i++;
-    long load;
-    if (cmSystemTools::StringToLong(args[i].c_str(), &load))
+    unsigned long load;
+    if (cmSystemTools::StringToULong(args[i].c_str(), &load))
       {
       this->SetTestLoad(load);
       }
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index e045381..47245ae 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -161,8 +161,8 @@ public:
   int GetParallelLevel() { return this->ParallelLevel; }
   void SetParallelLevel(int);
 
-  long GetTestLoad() { return this->TestLoad; }
-  void SetTestLoad(long);
+  unsigned long GetTestLoad() { return this->TestLoad; }
+  void SetTestLoad(unsigned long);
 
   /**
    * Check if CTest file exists
@@ -502,7 +502,7 @@ private:
   int                     ParallelLevel;
   bool                    ParallelLevelSetInCli;
 
-  long                    TestLoad;
+  unsigned long           TestLoad;
 
   int                     CompatibilityMode;
 
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index d0c4ed6..91f8d6e 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -1,4 +1,5 @@
 include(RunCMake)
+set(RunCMake_TEST_TIMEOUT 10)
 
 unset(ENV{CTEST_PARALLEL_LEVEL})
 unset(ENV{CTEST_OUTPUT_ON_FAILURE})
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt
index 6e7d816..153da09 100644
--- a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt
+++ b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt
@@ -1,2 +1,2 @@
 ^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad
-\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test TestLoad2 requires 1\*\*\*\*\*
+\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test TestLoad[1-2] requires 1\*\*\*\*\*
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index eb7243e..667e107 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -1,4 +1,5 @@
 include(RunCTest)
+set(RunCMake_TEST_TIMEOUT 10)
 
 set(CASE_CTEST_TEST_ARGS "")
 set(CASE_CTEST_TEST_LOAD "")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=308bc4145198d6ae54c09d1be24f40aefe11804e
commit 308bc4145198d6ae54c09d1be24f40aefe11804e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 24 09:53:37 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jun 24 10:10:31 2015 -0400

    Tests: Teach RunCMake infrastructure to optionally timeout
    
    Add a RunCMake_TEST_TIMEOUT option that tests can set to cause RunCMake
    to limit the time it waits for the child process to finish.

diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 70c0d6c..46bc494 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -66,6 +66,11 @@ function(run_cmake test)
   else()
     set(actual_stderr_var actual_stderr)
   endif()
+  if(DEFINED RunCMake_TEST_TIMEOUT)
+    set(maybe_timeout TIMEOUT ${RunCMake_TEST_TIMEOUT})
+  else()
+    set(maybe_timeout "")
+  endif()
   if(RunCMake_TEST_COMMAND)
     execute_process(
       COMMAND ${RunCMake_TEST_COMMAND}
@@ -73,6 +78,7 @@ function(run_cmake test)
       OUTPUT_VARIABLE actual_stdout
       ERROR_VARIABLE ${actual_stderr_var}
       RESULT_VARIABLE actual_result
+      ${maybe_timeout}
       )
   else()
     execute_process(
@@ -87,6 +93,7 @@ function(run_cmake test)
       OUTPUT_VARIABLE actual_stdout
       ERROR_VARIABLE ${actual_stderr_var}
       RESULT_VARIABLE actual_result
+      ${maybe_timeout}
       )
   endif()
   set(msg "")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f095fdbba2509ad886c1713e1b286bc774726125
commit f095fdbba2509ad886c1713e1b286bc774726125
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 24 09:41:58 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jun 24 09:42:27 2015 -0400

    cmSystemTools: Add StringToULong helper
    
    Convert a string to an unsigned integer and reject any extra input.

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index e2adabe..7230a64 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2955,3 +2955,12 @@ bool cmSystemTools::StringToLong(const char* str, long* value)
   *value = strtol(str, &endp, 10);
   return (*endp == '\0') && (endp != str) && (errno == 0);
 }
+
+//----------------------------------------------------------------------------
+bool cmSystemTools::StringToULong(const char* str, unsigned long* value)
+{
+  errno = 0;
+  char *endp;
+  *value = strtoul(str, &endp, 10);
+  return (*endp == '\0') && (endp != str) && (errno == 0);
+}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 6feb6c5..8ebb4e3 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -469,6 +469,7 @@ public:
 
   /** Convert string to long. Expected that the whole string is an integer */
   static bool StringToLong(const char* str, long* value);
+  static bool StringToULong(const char* str, unsigned long* value);
 
 #ifdef _WIN32
   struct WindowsFileRetry

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

Summary of changes:
 Source/CTest/cmCTestGenericHandler.h               |    6 +-
 Source/CTest/cmCTestMultiProcessHandler.cxx        |   71 +++++++++++---------
 Source/CTest/cmCTestMultiProcessHandler.h          |    4 +-
 Source/CTest/cmCTestTestCommand.cxx                |    6 +-
 Source/cmCTest.cxx                                 |   12 ++--
 Source/cmCTest.h                                   |    6 +-
 Source/cmSystemTools.cxx                           |    9 +++
 Source/cmSystemTools.h                             |    1 +
 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake |    1 +
 .../CTestCommandLine/test-load-fail-stdout.txt     |    2 +-
 Tests/RunCMake/RunCMake.cmake                      |    7 ++
 Tests/RunCMake/ctest_test/RunCMakeTest.cmake       |    1 +
 12 files changed, 76 insertions(+), 50 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list