[Cmake-commits] [cmake-commits] zach.mullen committed cmCTestMultiProcessHandler.cxx 1.20 1.21 cmCTestMultiProcessHandler.h 1.12 1.13 cmCTestRunTest.cxx 1.16 1.17 cmCTestTestHandler.cxx 1.118 1.119 cmCTestTestHandler.h 1.48 1.49

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Sep 10 11:16:10 EDT 2009


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

Modified Files:
	cmCTestMultiProcessHandler.cxx cmCTestMultiProcessHandler.h 
	cmCTestRunTest.cxx cmCTestTestHandler.cxx cmCTestTestHandler.h 
Log Message:
BUG: Fixed segfault and bad reporting if a ctest executable could not be found.  Also added some batch testing code that is not yet complete.


Index: cmCTestMultiProcessHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -C 2 -d -r1.20 -r1.21
*** cmCTestMultiProcessHandler.cxx	8 Sep 2009 21:10:33 -0000	1.20
--- cmCTestMultiProcessHandler.cxx	10 Sep 2009 15:16:07 -0000	1.21
***************
*** 28,31 ****
--- 28,36 ----
    this->RunningCount = 0;
  }
+ 
+ cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler()
+ {
+ }
+ 
    // Set the tests
  void 
***************
*** 56,64 ****
  void cmCTestMultiProcessHandler::RunTests()
  {
-   if(this->CTest->GetBatchJobs())
-     {
-     this->SubmitBatchTests();
-     return;
-     }
    this->CheckResume();
    this->TestHandler->SetMaxIndex(this->FindMaxIndex());
--- 61,64 ----
***************
*** 77,92 ****
  
  //---------------------------------------------------------
- void cmCTestMultiProcessHandler::SubmitBatchTests()
- {
-   for(cmCTest::CTestConfigurationMap::iterator i =
-       this->CTest->CTestConfiguration.begin();
-       i != this->CTest->CTestConfiguration.end(); ++i)
-     {
-     cmCTestLog(this->CTest, HANDLER_OUTPUT, i->first 
-                << " = " << i->second << std::endl);
-     }
- }
- 
- //---------------------------------------------------------
  void cmCTestMultiProcessHandler::StartTestProcess(int test)
  {
--- 77,80 ----

Index: cmCTestMultiProcessHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C 2 -d -r1.12 -r1.13
*** cmCTestMultiProcessHandler.h	8 Sep 2009 21:10:34 -0000	1.12
--- cmCTestMultiProcessHandler.h	10 Sep 2009 15:16:07 -0000	1.13
***************
*** 37,47 ****
  
    cmCTestMultiProcessHandler();
    // Set the tests
    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 RunTests();
    void PrintTestList();
-   void SubmitBatchTests();
  
    void SetPassFailVectors(std::vector<cmStdString>* passed,
--- 37,47 ----
  
    cmCTestMultiProcessHandler();
+   virtual ~cmCTestMultiProcessHandler();
    // Set the tests
    void SetTests(TestMap& tests, PropertiesMap& properties);
    // Set the max number of tests that can be run at the same time.
    void SetParallelLevel(size_t);
!   virtual void RunTests();
    void PrintTestList();
  
    void SetPassFailVectors(std::vector<cmStdString>* passed,

Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.118
retrieving revision 1.119
diff -C 2 -d -r1.118 -r1.119
*** cmCTestTestHandler.cxx	8 Sep 2009 21:10:35 -0000	1.118
--- cmCTestTestHandler.cxx	10 Sep 2009 15:16:08 -0000	1.119
***************
*** 18,21 ****
--- 18,22 ----
  #include "cmCTestTestHandler.h"
  #include "cmCTestMultiProcessHandler.h"
+ #include "cmCTestBatchTestHandler.h"
  #include "cmCTest.h"
  #include "cmCTestRunTest.h"
***************
*** 1000,1007 ****
    double elapsed_time_start = cmSystemTools::GetTime();
  
!   cmCTestMultiProcessHandler parallel;
!   parallel.SetCTest(this->CTest);
!   parallel.SetParallelLevel(this->CTest->GetParallelLevel());
!   parallel.SetTestHandler(this);
  
    *this->LogFile << "Start testing: "
--- 1001,1009 ----
    double elapsed_time_start = cmSystemTools::GetTime();
  
!   cmCTestMultiProcessHandler* parallel = this->CTest->GetBatchJobs() ?
!     new cmCTestBatchTestHandler : new cmCTestMultiProcessHandler;
!   parallel->SetCTest(this->CTest);
!   parallel->SetParallelLevel(this->CTest->GetParallelLevel());
!   parallel->SetTestHandler(this);
  
    *this->LogFile << "Start testing: "
***************
*** 1014,1018 ****
    
    for (ListOfTests::iterator it = this->TestList.begin();
!        it != this->TestList.end(); it ++ )
      { 
      cmCTestTestProperties& p = *it;
--- 1016,1020 ----
    
    for (ListOfTests::iterator it = this->TestList.begin();
!        it != this->TestList.end(); ++it)
      { 
      cmCTestTestProperties& p = *it;
***************
*** 1022,1029 ****
        {
        for(std::vector<std::string>::iterator i = p.Depends.begin();
!         i != p.Depends.end(); ++i)
          {
          for(ListOfTests::iterator it2 = this->TestList.begin();
!             it2 != this->TestList.end(); it2 ++ )
            {
            if(it2->Name == *i)
--- 1024,1031 ----
        {
        for(std::vector<std::string>::iterator i = p.Depends.begin();
!           i != p.Depends.end(); ++i)
          {
          for(ListOfTests::iterator it2 = this->TestList.begin();
!             it2 != this->TestList.end(); ++it2)
            {
            if(it2->Name == *i)
***************
*** 1038,1053 ****
      properties[it->Index] = &*it;
      }
!   parallel.SetTests(tests, properties);
!   parallel.SetPassFailVectors(&passed, &failed);
    this->TestResults.clear();
!   parallel.SetTestResults(&this->TestResults);
    if(this->CTest->GetShowOnly())
      {
!     parallel.PrintTestList();
      }
    else
      {
!     parallel.RunTests();
      }
    this->EndTest = this->CTest->CurrentTime();
    this->EndTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
--- 1040,1056 ----
      properties[it->Index] = &*it;
      }
!   parallel->SetTests(tests, properties);
!   parallel->SetPassFailVectors(&passed, &failed);
    this->TestResults.clear();
!   parallel->SetTestResults(&this->TestResults);
    if(this->CTest->GetShowOnly())
      {
!     parallel->PrintTestList();
      }
    else
      {
!     parallel->RunTests();
      }
+   delete parallel;
    this->EndTest = this->CTest->CurrentTime();
    this->EndTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());

Index: cmCTestTestHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -C 2 -d -r1.48 -r1.49
*** cmCTestTestHandler.h	8 Sep 2009 17:39:13 -0000	1.48
--- cmCTestTestHandler.h	10 Sep 2009 15:16:08 -0000	1.49
***************
*** 33,36 ****
--- 33,37 ----
    friend class cmCTestRunTest;
    friend class cmCTestMultiProcessHandler;
+   friend class cmCTestBatchTestHandler;
  public:
    cmTypeMacro(cmCTestTestHandler, cmCTestGenericHandler);

Index: cmCTestRunTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunTest.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -C 2 -d -r1.16 -r1.17
*** cmCTestRunTest.cxx	8 Sep 2009 14:16:15 -0000	1.16
--- cmCTestRunTest.cxx	10 Sep 2009 15:16:08 -0000	1.17
***************
*** 93,99 ****
    std::string reason;
    bool passed = true;
!   int res = this->TestProcess->GetProcessStatus();
    int retVal = this->TestProcess->GetExitValue();
- 
    std::vector<std::pair<cmsys::RegularExpression,
      std::string> >::iterator passIt;
--- 93,99 ----
    std::string reason;
    bool passed = true;
!   int res = started ? this->TestProcess->GetProcessStatus()
!                     : cmsysProcess_State_Error;
    int retVal = this->TestProcess->GetExitValue();
    std::vector<std::pair<cmsys::RegularExpression,
      std::string> >::iterator passIt;
***************
*** 198,202 ****
  
    passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED;
- 
    char buf[1024];
    sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime());
--- 198,201 ----
***************
*** 209,215 ****
    // if this is doing MemCheck then all the output needs to be put into
    // Output since that is what is parsed by cmCTestMemCheckHandler
!   if(!this->TestHandler->MemCheck)
      {
!     if ( this->TestResult.Status == cmCTestTestHandler::COMPLETED )
        {
        this->TestHandler->CleanTestOutput(this->ProcessOutput, 
--- 208,214 ----
    // if this is doing MemCheck then all the output needs to be put into
    // Output since that is what is parsed by cmCTestMemCheckHandler
!   if(!this->TestHandler->MemCheck && started)
      {
!     if (this->TestResult.Status == cmCTestTestHandler::COMPLETED)
        {
        this->TestHandler->CleanTestOutput(this->ProcessOutput, 
***************
*** 225,229 ****
      }
    this->TestResult.Reason = reason;
!   if ( this->TestHandler->LogFile )
      {
      bool pass = true;
--- 224,228 ----
      }
    this->TestResult.Reason = reason;
!   if (this->TestHandler->LogFile)
      {
      bool pass = true;
***************
*** 273,280 ****
      this->TestResult.CompletionStatus = "Completed";
      this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
!     this->TestHandler->TestResults.push_back( this->TestResult );
!     }
!   this->MemCheckPostProcess();
  
    delete this->TestProcess;
    return passed;
--- 272,279 ----
      this->TestResult.CompletionStatus = "Completed";
      this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
!     this->TestHandler->TestResults.push_back(this->TestResult);
  
+     this->MemCheckPostProcess();
+     }
    delete this->TestProcess;
    return passed;
***************
*** 325,331 ****
    this->TestResult.Path = this->TestProperties->Directory.c_str();
    
!   // continue if we did not find the executable
!   if (this->TestCommand == "")
      {
      *this->TestHandler->LogFile << "Unable to find executable: " 
                     << args[1].c_str() << std::endl;
--- 324,331 ----
    this->TestResult.Path = this->TestProperties->Directory.c_str();
    
!   // log and return if we did not find the executable
!   if (this->ActualCommand == "")
      {
+     this->TestProcess = new cmProcess;
      *this->TestHandler->LogFile << "Unable to find executable: " 
                     << args[1].c_str() << std::endl;
***************
*** 333,342 ****
                 << args[1].c_str() << std::endl);
      this->TestResult.Output = "Unable to find executable: " + args[1];
!     if ( !this->CTest->GetShowOnly() )
!       {
!       this->TestResult.FullCommandLine = this->ActualCommand;
!       this->TestHandler->TestResults.push_back( this->TestResult );
!       return false;
!       }
      }
    this->StartTime = this->CTest->CurrentTime();
--- 333,339 ----
                 << args[1].c_str() << std::endl);
      this->TestResult.Output = "Unable to find executable: " + args[1];
!     this->TestResult.FullCommandLine = "";
!     this->TestHandler->TestResults.push_back(this->TestResult);
!     return false;
      }
    this->StartTime = this->CTest->CurrentTime();



More information about the Cmake-commits mailing list