Procházet zdrojové kódy

ENH: Added PARALLEL_LEVEL option for ctest_memcheck(). Added PROCESSORS option to set_tests_properties (implementation to come).

Zach Mullen před 16 roky
rodič
revize
659171d1f7

+ 4 - 2
Source/CTest/cmCTestMemCheckCommand.h

@@ -67,7 +67,8 @@ public:
       "             [STRIDE stride number] [EXCLUDE exclude regex ]\n"
       "             [INCLUDE include regex] \n" 
       "             [EXCLUDE_LABEL exclude regex] \n"
-      "             [INCLUDE_LABEL label regex] )\n"
+      "             [INCLUDE_LABEL label regex] \n"
+      "             [PARALLEL_LEVEL level] )\n"
       "Tests the given build directory and stores results in MemCheck.xml. "
       "The second argument is a variable that will hold value. Optionally, "
       "you can specify the starting test number START, the ending test number "
@@ -75,7 +76,8 @@ public:
       "expression for tests to run INCLUDE, or a regular expression for tests "
       "not to run EXCLUDE. EXCLUDE_LABEL and INCLUDE_LABEL are regular "
       "expressions for tests to be included or excluded by the test "
-      "property LABEL."
+      "property LABEL. PARALLEL_LEVEL should be set to a positive number "
+      "representing the number of tests to be run in parallel."
       "\n"
       CTEST_COMMAND_APPEND_OPTION_DOCS;
     }

+ 6 - 3
Source/CTest/cmCTestMultiProcessHandler.cxx

@@ -74,10 +74,10 @@ void cmCTestMultiProcessHandler::RunTests()
 void cmCTestMultiProcessHandler::SubmitBatchTests()
 {
   for(cmCTest::CTestConfigurationMap::iterator i =
-    this->CTest->CTestConfiguration.begin();
-    i != this->CTest->CTestConfiguration.end(); ++i)
+      this->CTest->CTestConfiguration.begin();
+      i != this->CTest->CTestConfiguration.end(); ++i)
     {
-    cmCTestLog(this->CTest, HANDLER_OUTPUT, i->first
+    cmCTestLog(this->CTest, HANDLER_OUTPUT, i->first 
                << " = " << i->second << std::endl);
     }
 }
@@ -161,6 +161,9 @@ void cmCTestMultiProcessHandler::StartNextTests()
   for(TestMap::iterator i = tests.begin();
       i !=  tests.end(); ++i)
     {
+    int processors = this->Properties[i->first]->Processors;
+    
+//    if(processors > )
     // start test should start only one test
     if(this->StartTest(i->first))
       {

+ 1 - 1
Source/CTest/cmCTestRunTest.cxx

@@ -437,7 +437,7 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
 
   if ( this->TestHandler->MemCheck )
     {
-    cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory Check");
+    cmCTestLog(this->CTest, HANDLER_OUTPUT, "MemCheck");
     }
   else
     {

+ 9 - 0
Source/CTest/cmCTestTestHandler.cxx

@@ -1982,6 +1982,14 @@ bool cmCTestTestHandler::SetTestsProperties(
                   std::string(crit->c_str())));
               }
             }
+          if ( key == "PROCESSORS" )
+            {
+            rtit->Processors = atoi(val.c_str());
+            if(rtit->Processors < 1)
+              {
+              rtit->Processors = 1;
+              }
+            }
           if ( key == "DEPENDS" )
             {
             std::vector<std::string> lval;
@@ -2109,6 +2117,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
   test.IsInBasedOnREOptions = true;
   test.WillFail = false;
   test.Timeout = 0;
+  test.Processors = 1;
   if (this->UseIncludeRegExpFlag &&
     !this->IncludeTestsRegularExpression.find(testname.c_str()))
     {

+ 2 - 0
Source/CTest/cmCTestTestHandler.h

@@ -98,6 +98,8 @@ public:
     bool WillFail;
     double Timeout;
     int Index;
+    //Requested number of process slots
+    int Processors;
     std::vector<std::string> Environment;
     std::vector<std::string> Labels;
   };

+ 3 - 0
Source/cmSetTestsPropertiesCommand.h

@@ -69,6 +69,9 @@ public:
       "  Example: PASS_REGULAR_EXPRESSION \"[^a-z]Error;ERROR;Failed\"\n"
       "Both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect a "
       "list of regular expressions.\n";
+      "PROCESSORS: Denotes the number of processors that this test will "
+      "require. This is typically used for MPI tests, and should be used in "
+      "conjunction with the ctest_test PARALLEL_LEVEL option.\n";
     }
 
   cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand);

+ 2 - 2
Tests/CTestTest3/test.cmake.in

@@ -97,8 +97,8 @@ IF(svncommand)
   CTEST_UPDATE(SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res)
   CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
   CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
-  CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
-  CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+  CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res PARALLEL_LEVEL 5)
+  CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res PARALLEL_LEVEL 5)
   CTEST_COVERAGE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
   CTEST_SUBMIT(RETURN_VALUE res)