[Cmake-commits] [cmake-commits] zach.mullen committed cmCTestTestCommand.cxx 1.14 1.15 cmCTestTestCommand.h 1.14 1.15 cmCTestTestHandler.cxx 1.123 1.124

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Oct 29 15:30:14 EDT 2009


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

Modified Files:
	cmCTestTestCommand.cxx cmCTestTestCommand.h 
	cmCTestTestHandler.cxx 
Log Message:
Hook for scheduling tests in a random order

This may help statistically detect implicit dependencies among unit
tests while running in parallel.


Index: cmCTestTestCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestCommand.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C 2 -d -r1.14 -r1.15
*** cmCTestTestCommand.h	28 Sep 2009 15:43:02 -0000	1.14
--- cmCTestTestCommand.h	29 Oct 2009 19:30:12 -0000	1.15
***************
*** 62,66 ****
        "             [EXCLUDE_LABEL exclude regex] \n"
        "             [INCLUDE_LABEL label regex] \n"
!       "             [PARALLEL_LEVEL level]) \n"
        "Tests the given build directory and stores results in Test.xml. The "
        "second argument is a variable that will hold value. Optionally, "
--- 62,67 ----
        "             [EXCLUDE_LABEL exclude regex] \n"
        "             [INCLUDE_LABEL label regex] \n"
!       "             [PARALLEL_LEVEL level] \n"
!       "             [SCHEDULE_RANDOM on]) \n"
        "Tests the given build directory and stores results in Test.xml. The "
        "second argument is a variable that will hold value. Optionally, "
***************
*** 71,75 ****
        "expression for test to be included or excluded by the test "
        "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;
--- 72,78 ----
        "expression for test to be included or excluded by the test "
        "property LABEL. PARALLEL_LEVEL should be set to a positive number "
!       "representing the number of tests to be run in parallel. "
!       "SCHEDULE_RANDOM will launch tests in a random order, and is "
!       "typically used to detect implicit test dependencies."
        "\n"
        CTEST_COMMAND_APPEND_OPTION_DOCS;
***************
*** 93,96 ****
--- 96,100 ----
      ctt_INCLUDE_LABEL,
      ctt_PARALLEL_LEVEL,
+     ctt_SCHEDULE_RANDOM,
      ctt_LAST
    };

Index: cmCTestTestCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestCommand.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -C 2 -d -r1.14 -r1.15
*** cmCTestTestCommand.cxx	28 Sep 2009 15:43:02 -0000	1.14
--- cmCTestTestCommand.cxx	29 Oct 2009 19:30:12 -0000	1.15
***************
*** 25,28 ****
--- 25,29 ----
    this->Arguments[ctt_INCLUDE_LABEL] = "INCLUDE_LABEL";
    this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL";
+   this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM";
    this->Arguments[ctt_LAST] = 0;
    this->Last = ctt_LAST;
***************
*** 92,95 ****
--- 93,101 ----
                         this->Values[ctt_PARALLEL_LEVEL]);
      }
+   if(this->Values[ctt_SCHEDULE_RANDOM])
+     {
+     handler->SetOption("ScheduleRandom",
+                        this->Values[ctt_SCHEDULE_RANDOM]);
+     }
    return handler;
  }

Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.123
retrieving revision 1.124
diff -C 2 -d -r1.123 -r1.124
*** cmCTestTestHandler.cxx	5 Oct 2009 16:47:09 -0000	1.123
--- cmCTestTestHandler.cxx	29 Oct 2009 19:30:12 -0000	1.124
***************
*** 492,500 ****
    // Update internal data structure from generic one
    this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
!   this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion"))); 
    if(this->GetOption("ParallelLevel"))
      {
      this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel")));
      }
    const char* val;
    val = this->GetOption("LabelRegularExpression");
--- 492,505 ----
    // Update internal data structure from generic one
    this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
!   this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion")));
!   if(cmSystemTools::IsOn(this->GetOption("ScheduleRandom")))
!     {
!     this->CTest->SetScheduleType("Random");
!     }
    if(this->GetOption("ParallelLevel"))
      {
      this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel")));
      }
+ 
    const char* val;
    val = this->GetOption("LabelRegularExpression");
***************
*** 1022,1025 ****
--- 1027,1036 ----
    cmCTestMultiProcessHandler::PropertiesMap properties;
    
+   bool randomSchedule = this->CTest->GetScheduleType() == "Random";
+   if(randomSchedule)
+   {
+     srand((unsigned)time(0));
+   }
+ 
    for (ListOfTests::iterator it = this->TestList.begin();
         it != this->TestList.end(); ++it)
***************
*** 1028,1031 ****
--- 1039,1047 ----
      cmCTestMultiProcessHandler::TestSet depends;
  
+     if(randomSchedule)
+       {
+       p.Cost = rand();
+       }
+ 
      if(p.Depends.size())
        {



More information about the Cmake-commits mailing list