[Cmake-commits] [cmake-commits] zach.mullen committed cmCTestTestHandler.cxx 1.133 1.134 cmCTestTestHandler.h 1.53 1.54

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Dec 15 14:24:26 EST 2009


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

Modified Files:
	cmCTestTestHandler.cxx cmCTestTestHandler.h 
Log Message:
Changed XML formatting of files attached to test so that each file is archived and marked up individually, in order to make things easier on the CDash side.  Also switched to using the NamedMeasurement tag instead of a new tag.


Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.133
retrieving revision 1.134
diff -C 2 -d -r1.133 -r1.134
*** cmCTestTestHandler.cxx	15 Dec 2009 17:07:04 -0000	1.133
--- cmCTestTestHandler.cxx	15 Dec 2009 19:24:24 -0000	1.134
***************
*** 1256,1299 ****
  }
  
  void cmCTestTestHandler::AttachFiles(std::ostream& os,
                                       cmCTestTestResult* result)
  {
!   if(result->Properties->AttachedFiles.empty())
!     {
!     return;
!     }
! 
!   std::string base64 = this->EncodeFiles(result);
!   if(base64 == "")
      {
!     return;
!     }
!   os << "\t\t<AttachedFiles encoding=\"base64\" compression=\"tar/gzip\">\n"
!      << base64 << "\n"
!      << "\t\t</AttachedFiles>\n";
  }
  
  //----------------------------------------------------------------------
! std::string cmCTestTestHandler::EncodeFiles(cmCTestTestResult* result)
  {
!   //create the temp tar file
!   std::string tarFile = result->Name + "_attached.tar.gz";
    std::vector<cmStdString> files;
! 
!   for(std::vector<std::string>::iterator f = 
!       result->Properties->AttachedFiles.begin();
!       f != result->Properties->AttachedFiles.end(); ++f)
!     {
!     const cmStdString fname = f->c_str();
!     files.push_back(fname);
!     }
  
    if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false))
      {
      cmCTestLog(this->CTest, ERROR_MESSAGE, "Error creating tar while "
!       "attaching files to the following test: " << result->Name << std::endl);
      return "";
      }
- 
    long len = cmSystemTools::FileLength(tarFile.c_str());
    std::ifstream ifs(tarFile.c_str(), std::ios::in
--- 1256,1290 ----
  }
  
+ //----------------------------------------------------------------------
  void cmCTestTestHandler::AttachFiles(std::ostream& os,
                                       cmCTestTestResult* result)
  {
!   for(std::vector<std::string>::const_iterator file = 
!       result->Properties->AttachedFiles.begin();
!       file != result->Properties->AttachedFiles.end(); ++file)
      {
!     std::string base64 = this->EncodeFile(*file);
!     std::string fname = cmSystemTools::GetFilenameName(*file);
!     os << "\t\t<NamedMeasurement name=\"Attached File\" encoding=\"base64\" "
!       "compression=\"tar/gzip\" filename=\"" << fname << "\" type=\"file\">"
!       "\n\t\t\t<Value>\n\t\t\t"
!      << base64
!      << "\n\t\t\t</Value>\n\t\t</NamedMeasurement>\n";
!     } 
  }
  
  //----------------------------------------------------------------------
! std::string cmCTestTestHandler::EncodeFile(std::string file)
  {
!   std::string tarFile = file + "_temp.tar.gz";
    std::vector<cmStdString> files;
!   files.push_back(file);
  
    if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false))
      {
      cmCTestLog(this->CTest, ERROR_MESSAGE, "Error creating tar while "
!       "attaching file: " << file << std::endl);
      return "";
      }
    long len = cmSystemTools::FileLength(tarFile.c_str());
    std::ifstream ifs(tarFile.c_str(), std::ios::in

Index: cmCTestTestHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -C 2 -d -r1.53 -r1.54
*** cmCTestTestHandler.h	15 Dec 2009 17:07:07 -0000	1.53
--- cmCTestTestHandler.h	15 Dec 2009 19:24:24 -0000	1.54
***************
*** 148,152 ****
    void AttachFiles(std::ostream& os, cmCTestTestResult* result);
    // Helper function to encode attached test files
!   std::string EncodeFiles(cmCTestTestResult* result);
  
    //! Clean test output to specified length
--- 148,152 ----
    void AttachFiles(std::ostream& os, cmCTestTestResult* result);
    // Helper function to encode attached test files
!   std::string EncodeFile(std::string file);
  
    //! Clean test output to specified length



More information about the Cmake-commits mailing list