[Cmake-commits] [cmake-commits] king committed cmCTestMemCheckHandler.cxx 1.20 1.21 cmCTestTestHandler.cxx 1.89 1.90 cmCTestTestHandler.h 1.33 1.34

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Feb 2 13:24:28 EST 2009


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

Modified Files:
	cmCTestMemCheckHandler.cxx cmCTestTestHandler.cxx 
	cmCTestTestHandler.h 
Log Message:
ENH: Put test labels in MemCheck results

This refactors generation of <Test> element headers and footers in
cmCTestTestHandler and re-uses it in cmCTestMemCheckHandler.  The change
removes duplicate code and enables the new <Labels> element for MemCheck
results.


Index: cmCTestMemCheckHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestMemCheckHandler.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -C 2 -d -r1.20 -r1.21
*** cmCTestMemCheckHandler.cxx	12 Jan 2009 14:11:29 -0000	1.20
--- cmCTestMemCheckHandler.cxx	2 Feb 2009 18:24:26 -0000	1.21
***************
*** 338,365 ****
      this->CleanTestOutput(memcheckstr,
        static_cast<size_t>(this->CustomMaximumFailedTestOutputSize));
!     os << "\t<Test Status=\"";
!     if ( result->Status == cmCTestMemCheckHandler::COMPLETED )
!       {
!       os << "passed";
!       }
!     else if ( result->Status == cmCTestMemCheckHandler::NOT_RUN )
!       {
!       os << "notrun";
!       }
!     else
!       {
!       os << "failed";
!       }
!     std::string testPath = result->Path + "/" + result->Name;
!     os << "\">\n"
!       << "\t\t<Name>" << cmCTest::MakeXMLSafe(result->Name) << "</Name>\n"
!       << "\t\t<Path>" << cmCTest::MakeXMLSafe(
!         this->CTest->GetShortPathToFile(result->Path.c_str())) << "</Path>\n"
!       << "\t\t<FullName>" << cmCTest::MakeXMLSafe(
!         this->CTest->GetShortPathToFile(testPath.c_str())) << "</FullName>\n"
!       << "\t\t<FullCommandLine>"
!       << cmCTest::MakeXMLSafe(result->FullCommandLine)
!       << "</FullCommandLine>\n"
!       << "\t\t<Results>" << std::endl;
      for ( kk = 0; cmCTestMemCheckResultLongStrings[kk]; kk ++ )
        {
--- 338,343 ----
      this->CleanTestOutput(memcheckstr,
        static_cast<size_t>(this->CustomMaximumFailedTestOutputSize));
!     this->WriteTestResultHeader(os, result);
!     os << "\t\t<Results>" << std::endl;
      for ( kk = 0; cmCTestMemCheckResultLongStrings[kk]; kk ++ )
        {
***************
*** 376,381 ****
        << "\t\t</Results>\n"
        << "\t<Log>\n" << memcheckstr << std::endl
!       << "\t</Log>\n"
!       << "\t</Test>" << std::endl;
      if ( current < cc )
        {
--- 354,359 ----
        << "\t\t</Results>\n"
        << "\t<Log>\n" << memcheckstr << std::endl
!       << "\t</Log>\n";
!     this->WriteTestResultFooter(os, result);
      if ( current < cc )
        {

Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.89
retrieving revision 1.90
diff -C 2 -d -r1.89 -r1.90
*** cmCTestTestHandler.cxx	22 Jan 2009 12:16:05 -0000	1.89
--- cmCTestTestHandler.cxx	2 Feb 2009 18:24:26 -0000	1.90
***************
*** 1473,1500 ****
      {
      cmCTestTestResult *result = &this->TestResults[cc];
!     os << "\t<Test Status=\"";
!     if ( result->Status == cmCTestTestHandler::COMPLETED )
!       {
!       os << "passed";
!       }
!     else if ( result->Status == cmCTestTestHandler::NOT_RUN )
!       {
!       os << "notrun";
!       }
!     else
!       {
!       os << "failed";
!       }
!     std::string testPath = result->Path + "/" + result->Name;
!     os << "\">\n"
!       << "\t\t<Name>" << cmCTest::MakeXMLSafe(result->Name) << "</Name>\n"
!       << "\t\t<Path>" << cmCTest::MakeXMLSafe(
!         this->CTest->GetShortPathToFile(result->Path.c_str())) << "</Path>\n"
!       << "\t\t<FullName>" << cmCTest::MakeXMLSafe(
!         this->CTest->GetShortPathToFile(testPath.c_str())) << "</FullName>\n"
!       << "\t\t<FullCommandLine>"
!       << cmCTest::MakeXMLSafe(result->FullCommandLine)
!       << "</FullCommandLine>\n"
!       << "\t\t<Results>" << std::endl;
      if ( result->Status != cmCTestTestHandler::NOT_RUN )
        {
--- 1473,1478 ----
      {
      cmCTestTestResult *result = &this->TestResults[cc];
!     this->WriteTestResultHeader(os, result);
!     os << "\t\t<Results>" << std::endl;
      if ( result->Status != cmCTestTestHandler::NOT_RUN )
        {
***************
*** 1548,1566 ****
        << "\t\t\t</Measurement>\n"
        << "\t\t</Results>\n";
! 
!     if(!result->Properties->Labels.empty())
!       {
!       os << "\t\t<Labels>\n";
!       std::vector<std::string> const& labels = result->Properties->Labels;
!       for(std::vector<std::string>::const_iterator li = labels.begin();
!           li != labels.end(); ++li)
!         {
!         os << "\t\t\t<Label>" << cmCTest::MakeXMLSafe(*li) << "</Label>\n";
!         }
!       os << "\t\t</Labels>\n";
!       }
! 
!     os
!       << "\t</Test>" << std::endl;
      }
  
--- 1526,1530 ----
        << "\t\t\t</Measurement>\n"
        << "\t\t</Results>\n";
!     this->WriteTestResultFooter(os, result);
      }
  
***************
*** 1574,1577 ****
--- 1538,1590 ----
  }
  
+ //----------------------------------------------------------------------------
+ void cmCTestTestHandler::WriteTestResultHeader(std::ostream& os,
+                                                cmCTestTestResult* result)
+ {
+   os << "\t<Test Status=\"";
+   if ( result->Status == cmCTestTestHandler::COMPLETED )
+     {
+     os << "passed";
+     }
+   else if ( result->Status == cmCTestTestHandler::NOT_RUN )
+     {
+     os << "notrun";
+     }
+   else
+     {
+     os << "failed";
+     }
+   std::string testPath = result->Path + "/" + result->Name;
+   os << "\">\n"
+      << "\t\t<Name>" << cmCTest::MakeXMLSafe(result->Name) << "</Name>\n"
+      << "\t\t<Path>" << cmCTest::MakeXMLSafe(
+        this->CTest->GetShortPathToFile(result->Path.c_str())) << "</Path>\n"
+      << "\t\t<FullName>" << cmCTest::MakeXMLSafe(
+        this->CTest->GetShortPathToFile(testPath.c_str())) << "</FullName>\n"
+      << "\t\t<FullCommandLine>"
+      << cmCTest::MakeXMLSafe(result->FullCommandLine)
+      << "</FullCommandLine>\n";
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmCTestTestHandler::WriteTestResultFooter(std::ostream& os,
+                                                cmCTestTestResult* result)
+ {
+   if(!result->Properties->Labels.empty())
+     {
+     os << "\t\t<Labels>\n";
+     std::vector<std::string> const& labels = result->Properties->Labels;
+     for(std::vector<std::string>::const_iterator li = labels.begin();
+         li != labels.end(); ++li)
+       {
+       os << "\t\t\t<Label>" << cmCTest::MakeXMLSafe(*li) << "</Label>\n";
+       }
+     os << "\t\t</Labels>\n";
+     }
+ 
+   os
+     << "\t</Test>" << std::endl;
+ }
+ 
  //----------------------------------------------------------------------
  int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)

Index: cmCTestTestHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -C 2 -d -r1.33 -r1.34
*** cmCTestTestHandler.h	15 Jan 2009 15:32:56 -0000	1.33
--- cmCTestTestHandler.h	2 Feb 2009 18:24:26 -0000	1.34
***************
*** 135,138 ****
--- 135,141 ----
    int ExecuteCommands(std::vector<cmStdString>& vec);
  
+   void WriteTestResultHeader(std::ostream& os, cmCTestTestResult* result);
+   void WriteTestResultFooter(std::ostream& os, cmCTestTestResult* result);
+ 
    //! Clean test output to specified length
    bool CleanTestOutput(std::string& output, size_t length);



More information about the Cmake-commits mailing list