[Cmake-commits] [cmake-commits] zach.mullen committed cmCTestMultiProcessHandler.cxx 1.6 1.7 cmCTestMultiProcessHandler.h 1.3 1.4 cmCTestRunTest.cxx 1.2 1.3 cmCTestRunTest.h 1.1 1.2 cmCTestTestHandler.cxx 1.105 1.106 cmCTestTestHandler.h 1.39 1.40

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Aug 26 12:09:08 EDT 2009


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

Modified Files:
	cmCTestMultiProcessHandler.cxx cmCTestMultiProcessHandler.h 
	cmCTestRunTest.cxx cmCTestRunTest.h cmCTestTestHandler.cxx 
	cmCTestTestHandler.h 
Log Message:
ENH: refactored ctest.  All testing is now parallel.  If no -j option is specified, defaults to a MP level of 1 (non parallel)


Index: cmCTestRunTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunTest.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmCTestRunTest.cxx	20 Aug 2009 13:46:43 -0000	1.2
--- cmCTestRunTest.cxx	26 Aug 2009 16:09:05 -0000	1.3
***************
*** 22,28 ****
  cmCTestRunTest::cmCTestRunTest()
  {
-   this->OptimizeForCTest = true;
-   cmCTestTestHandler::cmCTestTestResult result;
-   this->TestResult = result;
  }
  
--- 22,25 ----
***************
*** 31,169 ****
  }
  
! void cmCTestRunTest::SetTestHandler(cmCTestTestHandler * handler)
  {
!   this->TestHandler = handler;
!   this->CTest = handler->CTest;
  }
  
! //----------------------------------------------------------------------
! // Executes a test.  Returns whether it passed or failed
! bool cmCTestRunTest::Execute()
  {
!   const std::string& testname = this->TestProperties->Name;
!   std::vector<std::string>& args = this->TestProperties->Args;
!   this->TestResult.Properties = this->TestProperties;
!   this->TestResult.ExecutionTime = 0;
!   this->TestResult.ReturnValue = -1;
!   this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
!   this->TestResult.TestCount = this->TestProperties->Index;  
!   this->TestResult.Name = testname;
!   this->TestResult.Path = this->TestProperties->Directory.c_str();
! 
!   cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) 
!              << this->TestProperties->Index << "/");
!   cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) 
!              << this->TestHandler->TotalNumberOfTests << " ");
!   if ( this->TestHandler->MemCheck )
!     {
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory Check");
!     }
!   else
!     {
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, "Testing");
!     }
!   cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
!   const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
!   std::string outname = testname + " ";
!   outname.resize(maxTestNameWidth, '.');
!   *this->TestHandler->LogFile << this->TestProperties->Index << "/" 
!     << this->TestHandler->TotalNumberOfTests << " Testing: " 
!     << testname << std::endl;
! 
!   if ( this->CTest->GetShowOnly() )
!     {
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str() << std::endl);
!     }
!   else
!     {
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str());
!     }
! 
!   cmCTestLog(this->CTest, DEBUG, "Testing " << args[0].c_str() << " ... ");
!   // find the test executable
!   std::string actualCommand 
!     = this->TestHandler->FindTheExecutable(args[1].c_str());
!   std::string testCommand
!     = cmSystemTools::ConvertToOutputPath(actualCommand.c_str());
! 
!   // continue if we did not find the executable
!   if (testCommand == "")
!     {
!     *this->TestHandler->LogFile << "Unable to find executable: " 
!                    << args[1].c_str() << std::endl;
!     cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find executable: "
!                << args[1].c_str() << std::endl);
!     this->TestResult.Output = "Unable to find executable: " + args[1];
!     if ( !this->CTest->GetShowOnly() )
!       {
!       this->TestResult.FullCommandLine = actualCommand;
!       this->TestHandler->TestResults.push_back( this->TestResult );
!       return false;
!       }
!     }
! 
!   // add the arguments
!   std::vector<std::string>::const_iterator j = args.begin();
!   ++j; // skip test name
!   ++j; // skip command as it is in actualCommand
!   std::vector<const char*> arguments;
!   this->TestHandler->GenerateTestCommand(arguments);
!   arguments.push_back(actualCommand.c_str());
!   for(;j != args.end(); ++j)
      {
!     testCommand += " ";
!     testCommand += cmSystemTools::EscapeSpaces(j->c_str());
!     arguments.push_back(j->c_str());
      }
!   arguments.push_back(0);
! 
!   /**
!    * Run an executable command and put the stdout in output.
!    */
!   std::string output;
!   int retVal = 0;
! 
!   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
!              << (this->TestHandler->MemCheck?"MemCheck":"Test") 
!              << " command: " << testCommand
!              << std::endl);
!   *this->TestHandler->LogFile << this->TestProperties->Index << "/" 
!                  << this->TestHandler->TotalNumberOfTests
!                  << " Test: " << testname.c_str() << std::endl;
!   *this->TestHandler->LogFile << "Command: ";
!   std::vector<cmStdString>::size_type ll;
!   for ( ll = 0; ll < arguments.size()-1; ll ++ )
      {
!     *this->TestHandler->LogFile << "\"" << arguments[ll] << "\" ";
      }
!   *this->TestHandler->LogFile
!     << std::endl
!     << "Directory: " << this->TestProperties->Directory << std::endl
!     << "\"" << testname.c_str() << "\" start time: "
!     << this->CTest->CurrentTime() << std::endl
!     << "Output:" << std::endl
!     << "----------------------------------------------------------"
!     << std::endl;
!   int res = 0;
!   double clock_start, clock_finish;
!   clock_start = cmSystemTools::GetTime();
  
!   if ( !this->CTest->GetShowOnly() )
      {
!     res = this->RunTestProcess(arguments, &output, &retVal,
!                                this->TestHandler->LogFile,
!                                this->TestProperties->Timeout,
!                                &this->TestProperties->Environment);
!     this->ProcessOutput = output; //save process output in the object
      }
! 
!   clock_finish = cmSystemTools::GetTime();  
! 
!   this->TestResult.ExecutionTime = (double)(clock_finish - clock_start);
!   this->TestResult.FullCommandLine = testCommand;
    std::string reason;
- 
    bool passed = true;
! 
    if ( !this->CTest->GetShowOnly() )
      {
--- 28,71 ----
  }
  
! bool cmCTestRunTest::IsRunning()
  {
!   return this->TestProcess->IsRunning();
  }
  
! //---------------------------------------------------------
! //waits .1 sec for output from this process.
! void cmCTestRunTest::CheckOutput()
  {
!   std::string out, err;
!   int pipe = this->TestProcess->CheckOutput(.1, out, err);
!   if(pipe == cmsysProcess_Pipe_STDOUT)
      {
!     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, 
!                this->GetIndex() << ": " << out << std::endl);
!     this->ProcessOutput += out;
!     this->ProcessOutput += "\n";
      }
!   else if(pipe == cmsysProcess_Pipe_STDERR)
      {
!     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, 
!                this->GetIndex() << ": " << err << std::endl);
!     this->ProcessOutput += err;
!     this->ProcessOutput += "\n";
      }
! }
  
! //---------------------------------------------------------
! bool cmCTestRunTest::EndTest()
! {
!   //restore the old environment
!   if (this->ModifyEnv)
      {
!     cmSystemTools::RestoreEnv(this->OrigEnv);
      }
!   this->WriteLogOutputTop();
    std::string reason;
    bool passed = true;
!   int res = this->TestProcess->GetProcessStatus();
!   int retVal = this->TestProcess->GetExitValue();
    if ( !this->CTest->GetShowOnly() )
      {
***************
*** 178,182 ****
              ++ passIt )
          {
!         if ( passIt->first.find(output.c_str()) )
            {
            found = true;
--- 80,84 ----
              ++ passIt )
          {
!         if ( passIt->first.find(this->ProcessOutput.c_str()) )
            {
            found = true;
***************
*** 205,209 ****
              ++ passIt )
          {
!         if ( passIt->first.find(output.c_str()) )
            {
            reason = "Error regular expression found in output.";
--- 107,111 ----
              ++ passIt )
          {
!         if ( passIt->first.find(this->ProcessOutput.c_str()) )
            {
            reason = "Error regular expression found in output.";
***************
*** 215,219 ****
          }
        }
- 
      if (res == cmsysProcess_State_Exited)
        {
--- 117,120 ----
***************
*** 225,235 ****
          {
          this->TestResult.Status = cmCTestTestHandler::COMPLETED;
!         cmCTestLog(this->CTest, HANDLER_OUTPUT,   "   Passed  " );
          }
        else
          {
          this->TestResult.Status = cmCTestTestHandler::FAILED;
!         cmCTestLog(this->CTest, HANDLER_OUTPUT,
!                    "***Failed  " << reason );
          }
        }
--- 126,135 ----
          {
          this->TestResult.Status = cmCTestTestHandler::COMPLETED;
!         cmCTestLog(this->CTest, HANDLER_OUTPUT, "   Passed  " );
          }
        else
          {
          this->TestResult.Status = cmCTestTestHandler::FAILED;
!         cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Failed  " << reason );
          }
        }
***************
*** 274,286 ****
  
      char buf[1024];
!     sprintf(buf, "%6.2f sec", this->TestResult.ExecutionTime);
      cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n" );
      if ( this->TestHandler->LogFile )
        {
!       *this->TestHandler->LogFile << "\nTest time = " << buf << std::endl;
        }
!     this->DartProcessing(output);
      } 
- 
    // if this is doing MemCheck then all the output needs to be put into
    // Output since that is what is parsed by cmCTestMemCheckHandler
--- 174,185 ----
  
      char buf[1024];
!     sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime());
      cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n" );
      if ( this->TestHandler->LogFile )
        {
!       *this->TestHandler->LogFile << "Test time = " << buf << std::endl;
        }
!     this->DartProcessing();
      } 
    // if this is doing MemCheck then all the output needs to be put into
    // Output since that is what is parsed by cmCTestMemCheckHandler
***************
*** 289,299 ****
      if ( this->TestResult.Status == cmCTestTestHandler::COMPLETED )
        {
!       this->TestHandler->CleanTestOutput(output, static_cast<size_t>
!                      (this->TestHandler->CustomMaximumPassedTestOutputSize));
        }
      else
        {
!       this->TestHandler->CleanTestOutput(output, static_cast<size_t>
!                      (this->TestHandler->CustomMaximumFailedTestOutputSize));
        }
      }
--- 188,200 ----
      if ( this->TestResult.Status == cmCTestTestHandler::COMPLETED )
        {
!       this->TestHandler->CleanTestOutput(this->ProcessOutput, 
!           static_cast<size_t>
!           (this->TestHandler->CustomMaximumPassedTestOutputSize));
        }
      else
        {
!       this->TestHandler->CleanTestOutput(this->ProcessOutput,
!           static_cast<size_t>
!           (this->TestHandler->CustomMaximumFailedTestOutputSize));
        }
      }
***************
*** 309,313 ****
        pass = false;
        }
!     double ttime = clock_finish - clock_start;
      int hours = static_cast<int>(ttime / (60 * 60));
      int minutes = static_cast<int>(ttime / 60) % 60;
--- 210,214 ----
        pass = false;
        }
!     double ttime = this->TestProcess->GetTotalTime();
      int hours = static_cast<int>(ttime / (60 * 60));
      int minutes = static_cast<int>(ttime / 60) % 60;
***************
*** 334,365 ****
          }
        }
!     *this->TestHandler->LogFile << "\"" << testname.c_str() << "\" end time: "
!       << this->CTest->CurrentTime() << std::endl
!       << "\"" << testname.c_str() << "\" time elapsed: "
        << buffer << std::endl
        << "----------------------------------------------------------"
        << std::endl << std::endl;
      }
!   this->TestResult.Output = output;
!   this->TestResult.ReturnValue = retVal;
    this->TestResult.CompletionStatus = "Completed";
    this->TestHandler->TestResults.push_back( this->TestResult );
  
    return passed;
  }
  
  //----------------------------------------------------------------------
! void cmCTestRunTest::DartProcessing(std::string& output)
  {
!   if (!output.empty() && output.find("<DartMeasurement") != output.npos)
      {
!     if (this->TestHandler->DartStuff.find(output.c_str()))
        {
        std::string dartString = this->TestHandler->DartStuff.match(1);
        // keep searching and replacing until none are left
!       while (this->TestHandler->DartStuff1.find(output.c_str()))
          {
          // replace the exact match for the string
!         cmSystemTools::ReplaceString(output,
                           this->TestHandler->DartStuff1.match(1).c_str(), "");
          }
--- 235,331 ----
          }
        }
!     *this->TestHandler->LogFile << "\"" << this->TestProperties->Name.c_str()
!       << "\" end time: " << this->CTest->CurrentTime() << std::endl
!       << "\"" << this->TestProperties->Name.c_str() << "\" time elapsed: "
        << buffer << std::endl
        << "----------------------------------------------------------"
        << std::endl << std::endl;
      }
!   this->TestResult.Output = this->ProcessOutput;
!   this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
    this->TestResult.CompletionStatus = "Completed";
+   this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
    this->TestHandler->TestResults.push_back( this->TestResult );
  
+   delete this->TestProcess;
    return passed;
  }
  
+ void cmCTestRunTest::SetTestHandler(cmCTestTestHandler * handler)
+ {
+   this->TestHandler = handler;
+   this->CTest = handler->CTest;
+ }
+ 
  //----------------------------------------------------------------------
! // Starts the execution of a test.  Returns once it has started
! bool cmCTestRunTest::StartTest()
  {
!   std::vector<std::string>& args = this->TestProperties->Args;
!   this->TestResult.Properties = this->TestProperties;
!   this->TestResult.ExecutionTime = 0;
!   this->TestResult.ReturnValue = -1;
!   this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
!   this->TestResult.TestCount = this->TestProperties->Index;  
!   this->TestResult.Name = this->TestProperties->Name;
!   this->TestResult.Path = this->TestProperties->Directory.c_str();
!   
!   // find the test executable
!   this->ActualCommand 
!     = this->TestHandler->FindTheExecutable(args[1].c_str());
!   this->TestCommand
!     = cmSystemTools::ConvertToOutputPath(this->ActualCommand.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;
!     cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find executable: "
!                << 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;
!       }
!     }
! 
!   /**
!    * Run an executable command and put the stdout in output.
!    */
!   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
!              << this->Index << ": "
!              << (this->TestHandler->MemCheck?"MemCheck":"Test") 
!              << " command: " << this->TestCommand
!              << std::endl);
! 
!   this->StartTime = this->CTest->CurrentTime();
! 
!   if ( !this->CTest->GetShowOnly() )
!     {
!     return this->CreateProcess(this->ActualCommand,
!                                this->TestProperties->Args,
!                                this->TestProperties->Timeout,
!                                &this->TestProperties->Environment);
!     }
!   return true;
! }
! 
! //----------------------------------------------------------------------
! void cmCTestRunTest::DartProcessing()
! {
!   if (!this->ProcessOutput.empty() && 
!      this->ProcessOutput.find("<DartMeasurement") != this->ProcessOutput.npos)
!     {
!     if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str()))
        {
        std::string dartString = this->TestHandler->DartStuff.match(1);
        // keep searching and replacing until none are left
!       while (this->TestHandler->DartStuff1.find(this->ProcessOutput.c_str()))
          {
          // replace the exact match for the string
!         cmSystemTools::ReplaceString(this->ProcessOutput,
                           this->TestHandler->DartStuff1.match(1).c_str(), "");
          }
***************
*** 371,381 ****
  
  //----------------------------------------------------------------------
! int cmCTestRunTest::RunTestProcess(std::vector<const char*> argv,
!                      std::string* output, int *retVal,
!                      std::ostream* log, double testTimeOut,
                       std::vector<std::string>* environment)
  {
    std::vector<std::string> origEnv;
!   bool modifyEnv = (environment && environment->size()>0);
  
    // determine how much time we have
--- 337,361 ----
  
  //----------------------------------------------------------------------
! bool cmCTestRunTest::CreateProcess(std::string command,
!                      std::vector<std::string> args,
!                      double testTimeOut,
                       std::vector<std::string>* environment)
  {
+   std::vector<std::string> commandArgs;
+   std::vector<std::string>::iterator i = args.begin();
+ 
+   ++i; //skip test name
+   ++i; //skip executable name
+   for(; i != args.end(); ++i)
+     {
+     commandArgs.push_back(*i);
+     }
+   this->TestProcess = new cmProcess;
+   this->TestProcess->SetId(this->Index);
+   this->TestProcess->SetCommand(command.c_str());
+   this->TestProcess->SetCommandArguments(commandArgs);
+ 
    std::vector<std::string> origEnv;
!   this->ModifyEnv = (environment && environment->size()>0);
  
    // determine how much time we have
***************
*** 396,548 ****
      timeout = 1;
      }
!   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
!              "Test timeout computed to be: " << timeout << "\n");
! 
!   if(cmSystemTools::SameFile(argv[0], this->CTest->CTestSelf.c_str()) &&
!      !this->CTest->ForceNewCTestProcess &&
!      this->OptimizeForCTest)
!     {
!     cmCTest inst;
!     inst.ConfigType = this->CTest->ConfigType;
!     inst.TimeOut = timeout;
! 
!     // Capture output of the child ctest.
!     cmOStringStream oss;
!     inst.SetStreams(&oss, &oss);
! 
!     std::vector<std::string> args;
!     for(unsigned int i =0; i < argv.size(); ++i)
!       {
!       if(argv[i])
!         {
!         // make sure we pass the timeout in for any build and test 
!         // invocations. Since --build-generator is required this is a 
!         // good place to check for it, and to add the arguments in
!         if (strcmp(argv[i],"--build-generator") == 0 && timeout)
!           {
!           args.push_back("--test-timeout");
!           cmOStringStream msg;
!           msg << timeout;
!           args.push_back(msg.str());
!           }
!         args.push_back(argv[i]);
!         }
!       }
!     if ( log )
!       {
!       *log << "* Run internal CTest" << std::endl;
!       }
!     std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory();
! 
!     if (modifyEnv)
!       {
!       origEnv = cmSystemTools::AppendEnv(environment);
!       }
! 
!     *retVal = inst.Run(args, output);
!     *output += oss.str();
!     if ( log )
!       {
!       *log << output->c_str();
!       }
!     cmSystemTools::ChangeDirectory(oldpath.c_str());
! 
!     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
!       "Internal cmCTest object used to run test." << std::endl
!       <<  *output << std::endl);
! 
!     if (modifyEnv)
!       {
!       cmSystemTools::RestoreEnv(origEnv);
!       }
  
!     return cmsysProcess_State_Exited;
!     }
!   std::vector<char> tempOutput;
!   if ( output )
      {
!     *output = "";
      }
  
!   if (modifyEnv)
      {
!     origEnv = cmSystemTools::AppendEnv(environment);
      }
! 
!   cmsysProcess* cp = cmsysProcess_New();
!   cmsysProcess_SetCommand(cp, &*argv.begin());
!   cmCTestLog(this->CTest, DEBUG, "Command is: " << argv[0] << std::endl);
!   if(cmSystemTools::GetRunCommandHideConsole())
      {
!     cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
      }
  
!   cmsysProcess_SetTimeout(cp, timeout);
!   cmsysProcess_Execute(cp);
! 
!   char* data;
!   int length;
!   while(cmsysProcess_WaitForData(cp, &data, &length, 0))
      {
!     if ( output )
!       {
!       tempOutput.insert(tempOutput.end(), data, data+length);
!       }
!     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
!       cmCTestLogWrite(data, length));
!     if ( log )
!       {
!       log->write(data, length);
!       }
      }
  
!   cmsysProcess_WaitForExit(cp, 0);
!   if(output && tempOutput.begin() != tempOutput.end())
      {
!     //We are waiting for exit before finally appending to the output
!     output->append(&*tempOutput.begin(), tempOutput.size());
      }
!   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "-- Process completed"
!     << std::endl);
  
!   int result = cmsysProcess_GetState(cp);
  
!   if(result == cmsysProcess_State_Exited)
!     {
!     *retVal = cmsysProcess_GetExitValue(cp);
!     if(*retVal != 0 && this->CTest->OutputTestOutputOnTestFailure)
!       {
!         this->CTest->OutputTestErrors(tempOutput);
!       }
!     }
!   else if(result == cmsysProcess_State_Exception)
!     {
!     if(this->CTest->OutputTestOutputOnTestFailure)
!       {
!         this->CTest->OutputTestErrors(tempOutput);
!       }
!     *retVal = cmsysProcess_GetExitException(cp);
!     std::string outerr = "\n*** Exception executing: ";
!     outerr += cmsysProcess_GetExceptionString(cp);
!     *output += outerr;
!     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, outerr.c_str()
!       << std::endl << std::flush);
!     }
!   else if(result == cmsysProcess_State_Error)
      {
!     std::string outerr = "\n*** ERROR executing: ";
!     outerr += cmsysProcess_GetErrorString(cp);
!     *output += outerr;
!     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, outerr.c_str()
!       << std::endl << std::flush);
      }
!   cmsysProcess_Delete(cp);
! 
!   if (modifyEnv)
      {
!     cmSystemTools::RestoreEnv(origEnv);
      }
  
!   return result;
  }
- 
--- 376,463 ----
      timeout = 1;
      }
!   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": "
!              << "Test timeout computed to be: " << timeout << "\n");
  
!   if (this->ModifyEnv)
      {
!     this->OrigEnv = cmSystemTools::AppendEnv(environment);
      }
  
!   return this->TestProcess->StartProcess();
! }
! 
! void cmCTestRunTest::WriteLogOutputTop()
! {
!   /* Not sure whether we want to prepend the test index anymore
!   cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3)
!              << this->Index << ": ");*/
!   cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) 
!              << this->TestProperties->Index << "/");
!   cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) 
!              << this->TestHandler->TotalNumberOfTests << " ");
!   if ( this->TestHandler->MemCheck )
      {
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory Check");
      }
!   else
      {
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, "Testing");
      }
+   cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
+   const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
+   std::string outname = this->TestProperties->Name + " ";
+   outname.resize(maxTestNameWidth, '.');
  
!   // add the arguments
!   std::vector<std::string>::const_iterator j = 
!     this->TestProperties->Args.begin();
!   ++j; // skip test name
!   ++j; // skip command as it is in actualCommand
!   std::vector<const char*> arguments;
!   this->TestHandler->GenerateTestCommand(arguments);
!   arguments.push_back(this->ActualCommand.c_str());
!   for(;j != this->TestProperties->Args.end(); ++j)
      {
!     this->TestCommand += " ";
!     this->TestCommand += cmSystemTools::EscapeSpaces(j->c_str());
!     arguments.push_back(j->c_str());
      }
+   arguments.push_back(0);
+   this->TestResult.FullCommandLine = this->TestCommand;
  
!   *this->TestHandler->LogFile << this->TestProperties->Index << "/" 
!     << this->TestHandler->TotalNumberOfTests << " Testing: " 
!     << this->TestProperties->Name << std::endl;
!   *this->TestHandler->LogFile << this->TestProperties->Index << "/" 
!     << this->TestHandler->TotalNumberOfTests
!     << " Test: " << this->TestProperties->Name.c_str() << std::endl;
!   *this->TestHandler->LogFile << "Command: ";
!   std::vector<cmStdString>::size_type ll;
!   for ( ll = 0; ll < arguments.size()-1; ll ++ )
      {
!     *this->TestHandler->LogFile << "\"" << arguments[ll] << "\" ";
      }
!   *this->TestHandler->LogFile << std::endl
!     << "Directory: " << this->TestProperties->Directory << std::endl
!     << "\"" << this->TestProperties->Name.c_str() << "\" start time: "
!     << this->StartTime << std::endl;
  
!   *this->TestHandler->LogFile
!     << "Output:" << std::endl
!     << "----------------------------------------------------------"
!     << std::endl;
!   *this->TestHandler->LogFile
!     << this->ProcessOutput.c_str() << "<end of output>" << std::endl;
  
!   if ( this->CTest->GetShowOnly() )
      {
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str() << std::endl);
      }
!   else
      {
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str());
      }
  
!   cmCTestLog(this->CTest, DEBUG, "Testing " 
!              << this->TestProperties->Name.c_str() << " ... ");
  }

Index: cmCTestMultiProcessHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmCTestMultiProcessHandler.cxx	12 Aug 2009 02:02:49 -0000	1.6
--- cmCTestMultiProcessHandler.cxx	26 Aug 2009 16:09:01 -0000	1.7
***************
*** 24,33 ****
  {
    this->ParallelLevel = 1;
-   this->ProcessId = 0;
  }
    // Set the tests
  void 
  cmCTestMultiProcessHandler::SetTests(TestMap& tests,
!                                      std::map<int,cmStdString>& testNames)
  {
    // set test run map to false for all
--- 24,32 ----
  {
    this->ParallelLevel = 1;
  }
    // Set the tests
  void 
  cmCTestMultiProcessHandler::SetTests(TestMap& tests,
!                                      PropertiesMap& properties)
  {
    // set test run map to false for all
***************
*** 39,51 ****
      }
    this->Tests = tests;
!   this->TestNames = testNames;
  }
    // Set the max number of tests that can be run at the same time.
! void cmCTestMultiProcessHandler::SetParallelLevel(size_t l)
  {
!   this->ParallelLevel = l;
  }
  
- 
  void cmCTestMultiProcessHandler::RunTests()
  {
--- 38,49 ----
      }
    this->Tests = tests;
!   this->Properties = properties;
  }
    // Set the max number of tests that can be run at the same time.
! void cmCTestMultiProcessHandler::SetParallelLevel(size_t level)
  {
!   this->ParallelLevel = level < 1 ? 1 : level;
  }
  
  void cmCTestMultiProcessHandler::RunTests()
  {
***************
*** 60,122 ****
      {
      }
-   
-   for(std::map<int, cmStdString>::iterator i =
-         this->TestOutput.begin();
-       i != this->TestOutput.end(); ++i)
-     {
-     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, 
-                i->second << std::endl);
-     }
-       
  }
  
  void cmCTestMultiProcessHandler::StartTestProcess(int test)
  {
!   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, 
!             " test " << test << "\n");
    this->TestRunningMap[test] = true; // mark the test as running
    // now remove the test itself
    this->Tests.erase(test);
!   // now run the test
!   cmProcess* newp = new cmProcess;
!   newp->SetId(this->ProcessId);
!   newp->SetId(test);
!   newp->SetCommand(this->CTestCommand.c_str());
!   std::vector<std::string> args;
!   cmOStringStream width;
!   if(this->CTest->GetMaxTestNameWidth())
!     {
!     args.push_back("-W");
!     width << this->CTest->GetMaxTestNameWidth();
!     args.push_back(width.str().c_str());
!     }
!   args.push_back("-I");
!   cmOStringStream strm;
!   strm << test << "," << test;
!   args.push_back(strm.str());
!   args.push_back("--parallel-cache");
!   args.push_back(this->CTestCacheFile.c_str());
!   args.push_back("--internal-ctest-parallel"); 
!   cmOStringStream strm2;
!   strm2 << test;
!   args.push_back(strm2.str());
!   if(this->CTest->GetExtraVerbose())
!     {
!     args.push_back("-VV");
!     }
!   newp->SetCommandArguments(args);
!   if(!newp->StartProcess())
      {
!      cmCTestLog(this->CTest, ERROR_MESSAGE, 
!                 "Error starting " << newp->GetCommand() << "\n");
!     this->EndTest(newp);
      }
    else
      {
!     this->RunningTests.insert(newp);
      }
-  cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, 
-             "ctest -I " << test << "\n");
-  this->ProcessId++;
  }
  
--- 58,83 ----
      {
      }
  }
  
  void cmCTestMultiProcessHandler::StartTestProcess(int test)
  {
!   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, test << ": "
!             << " test " << test << "\n");
    this->TestRunningMap[test] = true; // mark the test as running
    // now remove the test itself
    this->Tests.erase(test);
!   cmCTestRunTest* testRun = new cmCTestRunTest;
!   testRun->SetCTest(this->CTest);
!   testRun->SetTestHandler(this->TestHandler);
!   testRun->SetIndex(test);
!   testRun->SetTestProperties(this->Properties[test]);
!   if(testRun->StartTest())
      {
!     this->RunningTests.insert(testRun);
      }
    else
      {
!     testRun->EndTest();
      }
  }
  
***************
*** 161,165 ****
    // This test was not able to start because it is waiting 
    // on depends to run
!   return false;  
  }
  
--- 122,126 ----
    // This test was not able to start because it is waiting 
    // on depends to run
!   return false;
  }
  
***************
*** 196,200 ****
  }
  
- 
  bool cmCTestMultiProcessHandler::CheckOutput()
  {
--- 157,160 ----
***************
*** 204,228 ****
      return false;
      }
!   std::vector<cmProcess*> finished;
    std::string out, err;
!   for(std::set<cmProcess*>::const_iterator i = this->RunningTests.begin();
        i != this->RunningTests.end(); ++i)
      {
!     cmProcess* p = *i;
!     int pipe = p->CheckOutput(.1, out, err);
!     if(pipe == cmsysProcess_Pipe_STDOUT)
!       {
!       cmCTestLog(this->CTest, HANDLER_OUTPUT, 
!                  p->GetId() << ": " << out << std::endl);
!       this->TestOutput[ p->GetId() ] += out;
!       this->TestOutput[ p->GetId() ] += "\n";
!       }
!     else if(pipe == cmsysProcess_Pipe_STDERR)
!       {
!       cmCTestLog(this->CTest, HANDLER_OUTPUT, 
!                  p->GetId() << ": " << err << std::endl);
!       this->TestOutput[ p->GetId() ] += err;
!       this->TestOutput[ p->GetId() ] += "\n";
!       }
      if(!p->IsRunning())
        {
--- 164,175 ----
      return false;
      }
!   std::vector<cmCTestRunTest*> finished;
    std::string out, err;
!   for(std::set<cmCTestRunTest*>::const_iterator i = this->RunningTests.begin();
        i != this->RunningTests.end(); ++i)
      {
!     cmCTestRunTest* p = *i;
!     p->CheckOutput(); //reads and stores the process output
!     
      if(!p->IsRunning())
        {
***************
*** 230,283 ****
        }
      }
-   for( std::vector<cmProcess*>::iterator i = finished.begin();
-        i != finished.end(); ++i)
-     {
-     cmProcess* p = *i;
-     this->EndTest(p);
-     }
-   return true;
- }
  
! void cmCTestMultiProcessHandler::EndTest(cmProcess* p)
! {
!   // Should have a way of getting this stuff from the 
!   // launched ctest, maybe a temp file or some extra xml
!   // stuff in the stdout
!   // Need things like Reason and ExecutionTime, Path, etc.
!   int test = p->GetId();
!   int exitVal = p->GetExitValue();
!   cmCTestTestHandler::cmCTestTestResult cres;
!   cres.Properties = 0;
!   cres.ExecutionTime = p->GetTotalTime();
!   cres.ReturnValue = exitVal;
!   cres.Status = cmCTestTestHandler::COMPLETED;
!   cres.TestCount = test;  
!   cres.Name = this->TestNames[test];
!   cres.Path = "";
!   if(exitVal)
      {
!     cres.Status = cmCTestTestHandler::FAILED;
!     this->Failed->push_back(this->TestNames[test]);
!     }
!   else
      {
!     this->Passed->push_back(this->TestNames[test]);
      }
!   this->TestResults->push_back(cres);
!   // remove test from depend of all other tests
!   for(TestMap::iterator i = this->Tests.begin();
!        i!=  this->Tests.end(); ++i)
!     {
!     i->second.erase(test);
      }
!   this->TestFinishMap[test] = true;
!   this->TestRunningMap[test] = false;
!   this->RunningTests.erase(p);
!   delete p;
!   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, 
!              "finish test " << test << "\n");
  }
  
- 
  void cmCTestMultiProcessHandler::PrintTests()
  {
--- 177,209 ----
        }
      }
  
!   for( std::vector<cmCTestRunTest*>::iterator i = finished.begin();
!        i != finished.end(); ++i)
      {
!     cmCTestRunTest* p = *i;
!     int test = p->GetIndex();
!     
!     if(p->EndTest())
!       {
!         this->Passed->push_back(p->GetTestProperties()->Name);
!       }
!     else
!       {
!         this->Failed->push_back(p->GetTestProperties()->Name);
!       }
!     for(TestMap::iterator j = this->Tests.begin();
!        j!=  this->Tests.end(); ++j)
      {
!     j->second.erase(test);
      }
!     this->TestFinishMap[test] = true;
!     this->TestRunningMap[test] = false;
!     this->RunningTests.erase(p);
! 
!     delete p;
      }
!   return true;
  }
  
  void cmCTestMultiProcessHandler::PrintTests()
  {

Index: cmCTestTestHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -C 2 -d -r1.39 -r1.40
*** cmCTestTestHandler.h	19 Aug 2009 13:24:55 -0000	1.39
--- cmCTestTestHandler.h	26 Aug 2009 16:09:06 -0000	1.40
***************
*** 32,35 ****
--- 32,36 ----
  {
    friend class cmCTestRunTest;
+   friend class cmCTestMultiProcessHandler;
  public:
    cmTypeMacro(cmCTestTestHandler, cmCTestGenericHandler);
***************
*** 130,133 ****
--- 131,135 ----
                                      std::vector<std::string> &failed);
  
+   typedef std::vector<cmCTestTestProperties> ListOfTests;
  protected:
    // comput a final test list
***************
*** 194,198 ****
                          std::vector<cmStdString> &failed);
  
-   typedef std::vector<cmCTestTestProperties> ListOfTests;
    /**
     * Get the list of tests in directory and subdirectories.
--- 196,199 ----
***************
*** 222,228 ****
                  double& value,
                  std::ifstream& fin);
-   // run in -j N mode
-   void ProcessParallel(std::vector<cmStdString> &passed,
-                        std::vector<cmStdString> &failed);
    /**
     * Find the executable for a test
--- 223,226 ----

Index: cmCTestMultiProcessHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMultiProcessHandler.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** cmCTestMultiProcessHandler.h	7 Jul 2008 00:03:08 -0000	1.3
--- cmCTestMultiProcessHandler.h	26 Aug 2009 16:09:03 -0000	1.4
***************
*** 18,24 ****
  #define cmCTestMultiProcessHandler_h
  
- class cmProcess;
  #include <cmStandardIncludes.h>
  #include <cmCTestTestHandler.h>
  
  /** \class cmCTestMultiProcessHandler
--- 18,24 ----
  #define cmCTestMultiProcessHandler_h
  
  #include <cmStandardIncludes.h>
  #include <cmCTestTestHandler.h>
+ #include <cmCTestRunTest.h>
  
  /** \class cmCTestMultiProcessHandler
***************
*** 32,45 ****
    struct TestSet : public std::set<int> {};
    struct TestMap : public std::map<int, TestSet> {};
    cmCTestMultiProcessHandler();
    // Set the tests
!   void SetTests(TestMap& tests,
!                 std::map<int, cmStdString>& testNames);
    // Set the max number of tests that can be run at the same time.
    void SetParallelLevel(size_t);
    void RunTests();
    void PrintTests();
!   void SetCTestCommand(const char* c) { this->CTestCommand = c;}
!   void SetTestCacheFile(const char* c) { this->CTestCacheFile = c;}
    void SetPassFailVectors(std::vector<cmStdString>* passed,
                            std::vector<cmStdString>* failed)
--- 32,47 ----
    struct TestSet : public std::set<int> {};
    struct TestMap : public std::map<int, TestSet> {};
+   struct PropertiesMap : public 
+      std::map<int, cmCTestTestHandler::cmCTestTestProperties*> {};
+ 
    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 PrintTests();
!   //void SetCTestCommand(const char* c) { this->CTestCommand = c;}
!   //void SetTestCacheFile(const char* c) { this->CTestCacheFile = c;}
    void SetPassFailVectors(std::vector<cmStdString>* passed,
                            std::vector<cmStdString>* failed)
***************
*** 52,56 ****
--- 54,65 ----
        this->TestResults = r;
      }
+ 
    void SetCTest(cmCTest* ctest) { this->CTest = ctest;}
+ 
+   void SetTestHandler(cmCTestTestHandler * handler)
+   { this->TestHandler = handler; }
+ 
+   cmCTestTestHandler * GetTestHandler()
+   { return this->TestHandler; }
  protected:  
    cmCTest* CTest;
***************
*** 60,64 ****
    void StartTestProcess(int test);
    bool StartTest(int test);
!   void EndTest(cmProcess*);
    // Return true if there are still tests running
    // check all running processes for output and exit case
--- 69,73 ----
    void StartTestProcess(int test);
    bool StartTest(int test);
!   //void EndTest(cmProcess*);
    // Return true if there are still tests running
    // check all running processes for output and exit case
***************
*** 66,81 ****
    // map from test number to set of depend tests
    TestMap Tests;
!   std::map<int, cmStdString> TestNames;
    std::map<int, bool> TestRunningMap;
    std::map<int, bool> TestFinishMap;
    std::map<int, cmStdString> TestOutput;
!   std::string CTestCommand;
!   std::string CTestCacheFile;
    std::vector<cmStdString>* Passed;
    std::vector<cmStdString>* Failed;
    std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
-   int ProcessId;
    size_t ParallelLevel; // max number of process that can be run at once
!   std::set<cmProcess*> RunningTests;  // current running tests
  };
  
--- 75,91 ----
    // map from test number to set of depend tests
    TestMap Tests;
!   //list of test properties (indices concurrent to the test map)
!   PropertiesMap Properties;
    std::map<int, bool> TestRunningMap;
    std::map<int, bool> TestFinishMap;
    std::map<int, cmStdString> TestOutput;
!   //std::string CTestCommand;
!   //std::string CTestCacheFile;
    std::vector<cmStdString>* Passed;
    std::vector<cmStdString>* Failed;
    std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
    size_t ParallelLevel; // max number of process that can be run at once
!   std::set<cmCTestRunTest*> RunningTests;  // current running tests
!   cmCTestTestHandler * TestHandler;
  };
  

Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.105
retrieving revision 1.106
diff -C 2 -d -r1.105 -r1.106
*** cmCTestTestHandler.cxx	19 Aug 2009 13:24:55 -0000	1.105
--- cmCTestTestHandler.cxx	26 Aug 2009 16:09:06 -0000	1.106
***************
*** 544,549 ****
--- 544,556 ----
    std::vector<cmStdString> failed;
    int total;
+ 
+   //start the real time clock
+   double clock_start, clock_finish;
+   clock_start = cmSystemTools::GetTime();
+ 
    this->ProcessDirectory(passed, failed);
  
+   clock_finish = cmSystemTools::GetTime();
+ 
    total = int(passed.size()) + int(failed.size());
  
***************
*** 592,599 ****
          }
        
!       char buf[1024];
!       sprintf(buf, "%6.2f sec", totalTestTime); 
!       cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time = " 
!                  <<  buf << "\n" );
        
        }
--- 599,611 ----
          }
        
!       char realBuf[1024];
!       sprintf(realBuf, "%6.2f sec", (double)(clock_finish - clock_start));
!       cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = "
!                  << realBuf << "\n" );
! 
!       char totalBuf[1024];
!       sprintf(totalBuf, "%6.2f sec", totalTestTime); 
!       cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (parallel) = " 
!                  <<  totalBuf << "\n" );
        
        }
***************
*** 1529,1533 ****
  }
  
! void cmCTestTestHandler::ProcessParallel(std::vector<cmStdString> &passed,
                                           std::vector<cmStdString> &failed)
  {
--- 1541,1545 ----
  }
  
! void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
                                           std::vector<cmStdString> &failed)
  {
***************
*** 1535,1547 ****
    cmCTestMultiProcessHandler parallel;
    parallel.SetCTest(this->CTest);
!   parallel.SetParallelLevel(this->CTest->GetParallelLevel()); 
    cmCTestMultiProcessHandler::TestSet depends;
    cmCTestMultiProcessHandler::TestMap tests;
!   std::map<int, cmStdString> testnames;
    for (ListOfTests::iterator it = this->TestList.begin();
         it != this->TestList.end(); it ++ )
      { 
      cmCTestTestProperties& p = *it;
!     testnames[p.Index] = p.Name;
      if(p.Depends.size())
        {
--- 1547,1566 ----
    cmCTestMultiProcessHandler parallel;
    parallel.SetCTest(this->CTest);
!   parallel.SetParallelLevel(this->CTest->GetParallelLevel());
!   parallel.SetTestHandler(this);
! 
!   *this->LogFile << "Start testing: "
!     << this->CTest->CurrentTime() << std::endl
!     << "----------------------------------------------------------"
!     << std::endl;
! 
    cmCTestMultiProcessHandler::TestSet depends;
    cmCTestMultiProcessHandler::TestMap tests;
!   cmCTestMultiProcessHandler::PropertiesMap properties;
    for (ListOfTests::iterator it = this->TestList.begin();
         it != this->TestList.end(); it ++ )
      { 
      cmCTestTestProperties& p = *it;
!     
      if(p.Depends.size())
        {
***************
*** 1561,1634 ****
        }
      tests[it->Index] = depends;
      }
!   parallel.SetCTestCommand(this->CTest->GetCTestExecutable());
!   parallel.SetTests(tests, testnames);
!   std::string fname = this->SaveTestList();
!   parallel.SetTestCacheFile(fname.c_str());
    parallel.SetPassFailVectors(&passed, &failed);
    this->TestResults.clear();
    parallel.SetTestResults(&this->TestResults);
    parallel.RunTests();
-   cmSystemTools::RemoveFile(fname.c_str());
- }
  
! 
! //----------------------------------------------------------------------
! void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
!                                           std::vector<cmStdString> &failed)
! {
!   if(this->CTest->GetParallelLevel() > 0)
!     {
!     this->ProcessParallel(passed, failed);
!     return;
!     }
!   // save the current working directory
!   std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
!   // compute the list of tests to run
!   this->ComputeTestList();
!   this->StartTest = this->CTest->CurrentTime();
!   this->StartTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
!   double elapsed_time_start = cmSystemTools::GetTime();
!   *this->LogFile << "Start testing: " << this->StartTest << std::endl
!     << "----------------------------------------------------------"
!     << std::endl;
!   std::string last_directory = "";
! 
!   // run each test
!   for (ListOfTests::iterator it = this->TestList.begin();
!        it != this->TestList.end(); it ++ )
!     {
!     if (!(last_directory == it->Directory))
!       {
!       cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
!                  "Changing directory into " << it->Directory.c_str() << "\n");
!       *this->LogFile << "Changing directory into: " << it->Directory.c_str()
!                      << std::endl;
!       last_directory = it->Directory;
!       cmSystemTools::ChangeDirectory(it->Directory.c_str());
!       }
!     // process this one test
!     cmCTestRunTest testRun;
!     testRun.SetTestProperties(&(*it));
!     testRun.SetTestHandler(this);
! 
!     bool testPassed = testRun.Execute(); //run the test
!     if(testPassed && !this->CTest->GetShowOnly())
!       {
!       passed.push_back(it->Name);
!       }
!     else if(!testPassed)
!       {
!       failed.push_back(it->Name);
!       }
!     }  
!   this->EndTest = this->CTest->CurrentTime();
!   this->EndTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
!   this->ElapsedTestingTime = cmSystemTools::GetTime() - elapsed_time_start;
!   if ( this->LogFile )
!     {
!     *this->LogFile << "End testing: " << this->EndTest << std::endl;
!     }
!   cmSystemTools::ChangeDirectory(current_dir.c_str());
  }
  
--- 1580,1593 ----
        }
      tests[it->Index] = depends;
+     properties[it->Index] = &*it;
      }
!   parallel.SetTests(tests, properties);
    parallel.SetPassFailVectors(&passed, &failed);
    this->TestResults.clear();
    parallel.SetTestResults(&this->TestResults);
    parallel.RunTests();
  
!   *this->LogFile << "End testing: "
!      << this->CTest->CurrentTime() << std::endl;
  }
  

Index: cmCTestRunTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunTest.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmCTestRunTest.h	19 Aug 2009 12:58:32 -0000	1.1
--- cmCTestRunTest.h	26 Aug 2009 16:09:06 -0000	1.2
***************
*** 20,23 ****
--- 20,24 ----
  #include <cmStandardIncludes.h>
  #include <cmCTestTestHandler.h>
+ #include <cmProcess.h>
  
  /** \class cmRunTest
***************
*** 39,67 ****
    
    void SetTestHandler(cmCTestTestHandler * handler);
-   
-   void SetOptimizeForCTest(bool optimize)
-   { this->OptimizeForCTest = optimize; }
  
!   bool GetOptimizeForCTest()
!   { return this->OptimizeForCTest; }
  
!   std::string GetProcessOutput()
!   { return this->ProcessOutput; }
  
!   //Provides a handle to the log stream in case someone wants
!   // to asynchronously process the log
!   std::ostream * GetLogStream()
!   { return this->TestHandler->LogFile; }
  
    cmCTestTestHandler::cmCTestTestResult GetTestResults()
    { return this->TestResult; }
  
!   //Runs the test
!   bool Execute();
  protected:
!   void DartProcessing(std::string& output);
!   int RunTestProcess(std::vector<const char*> argv,
!                      std::string* output, int *retVal,
!                      std::ostream* log, double testTimeOut,
                       std::vector<std::string>* environment);
  private:
--- 40,66 ----
    
    void SetTestHandler(cmCTestTestHandler * handler);
  
!   void SetIndex(int i) { this->Index = i; }
  
!   void SetCTest(cmCTest * ct) { this->CTest = ct; }
  
!   int GetIndex() { return this->Index; }
! 
!   std::string GetProcessOutput() { return this->ProcessOutput; }
  
    cmCTestTestHandler::cmCTestTestResult GetTestResults()
    { return this->TestResult; }
  
!   bool IsRunning();
!   void CheckOutput();
!   //launch the test process, return whether it started correctly
!   bool StartTest();
!   //capture the test results and send them back to the test handler
!   bool EndTest();
  protected:
!   void DartProcessing();
!   bool CreateProcess(std::string executable,
!                      std::vector<std::string> args,
!                      double testTimeOut,
                       std::vector<std::string>* environment);
  private:
***************
*** 70,80 ****
    cmCTestTestHandler * TestHandler;
    cmCTest * CTest;
    //If the executable to run is ctest, don't create a new process; 
    //just instantiate a new cmTest.  (Can be disabled for a single test
    //if this option is set to false.)
!   bool OptimizeForCTest;
    std::string ProcessOutput;
    //The test results
    cmCTestTestHandler::cmCTestTestResult TestResult;
  };
  
--- 69,90 ----
    cmCTestTestHandler * TestHandler;
    cmCTest * CTest;
+   cmProcess * TestProcess;
    //If the executable to run is ctest, don't create a new process; 
    //just instantiate a new cmTest.  (Can be disabled for a single test
    //if this option is set to false.)
!   //bool OptimizeForCTest;
! 
!   //flag for whether the env was modified for this run
!   bool ModifyEnv;
!   //stores the original environment if we are modifying it
!   std::vector<std::string> OrigEnv;
    std::string ProcessOutput;
    //The test results
    cmCTestTestHandler::cmCTestTestResult TestResult;
+   int Index;
+   std::string StartTime;
+   std::string TestCommand;
+   std::string ActualCommand;
+   void WriteLogOutputTop();
  };
  



More information about the Cmake-commits mailing list