[Cmake-commits] [cmake-commits] hoffman committed cmCTestTestHandler.cxx 1.93 1.94

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Feb 27 16:28:10 EST 2009


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

Modified Files:
	cmCTestTestHandler.cxx 
Log Message:
BUG: #8642 add pass fail reasons into log file


Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.93
retrieving revision 1.94
diff -C 2 -d -r1.93 -r1.94
*** cmCTestTestHandler.cxx	24 Feb 2009 22:23:51 -0000	1.93
--- cmCTestTestHandler.cxx	27 Feb 2009 21:28:07 -0000	1.94
***************
*** 762,783 ****
    clock_finish = cmSystemTools::GetTime();  
  
!   if ( this->LogFile )
!     {
!     double ttime = clock_finish - clock_start;
!     int hours = static_cast<int>(ttime / (60 * 60));
!     int minutes = static_cast<int>(ttime / 60) % 60;
!     int seconds = static_cast<int>(ttime) % 60;
!     char buffer[100];
!     sprintf(buffer, "%02d:%02d:%02d", hours, minutes, seconds);
!     *this->LogFile
!       << "----------------------------------------------------------"
!       << std::endl
!       << "\"" << testname.c_str() << "\" end time: "
!       << this->CTest->CurrentTime() << std::endl
!       << "\"" << testname.c_str() << "\" time elapsed: "
!       << buffer << std::endl
!       << "----------------------------------------------------------"
!       << std::endl << std::endl;
!     }
    
    cres.ExecutionTime = (double)(clock_finish - clock_start);
--- 762,766 ----
    clock_finish = cmSystemTools::GetTime();  
  
! 
    
    cres.ExecutionTime = (double)(clock_finish - clock_start);
***************
*** 950,953 ****
--- 933,977 ----
      }
    cres.Reason = reason;
+   if ( this->LogFile )
+     {
+     bool pass = true;
+     const char* reasonType = "Test Pass Reason";
+     if(cres.Status != cmCTestTestHandler::COMPLETED &&
+        cres.Status != cmCTestTestHandler::NOT_RUN)
+       {
+       reasonType = "Test Fail Reason";
+       pass = false;
+       }
+     double ttime = clock_finish - clock_start;
+     int hours = static_cast<int>(ttime / (60 * 60));
+     int minutes = static_cast<int>(ttime / 60) % 60;
+     int seconds = static_cast<int>(ttime) % 60;
+     char buffer[100];
+     sprintf(buffer, "%02d:%02d:%02d", hours, minutes, seconds);
+     *this->LogFile
+       << "----------------------------------------------------------"
+       << std::endl;
+     if(cres.Reason.size())
+       {
+       *this->LogFile << reasonType << ":\n" << cres.Reason << "\n";
+       }
+     else 
+       {
+       if(pass)
+         {
+         *this->LogFile << "Test Passed.\n";
+         }
+       else
+         {
+         *this->LogFile << "Test Failed.\n";
+         }
+       }
+     *this->LogFile << "\"" << testname.c_str() << "\" end time: "
+       << this->CTest->CurrentTime() << std::endl
+       << "\"" << testname.c_str() << "\" time elapsed: "
+       << buffer << std::endl
+       << "----------------------------------------------------------"
+       << std::endl << std::endl;
+     }
    cres.Output = output;
    cres.ReturnValue = retVal;



More information about the Cmake-commits mailing list