[Cmake-commits] [cmake-commits] king committed cmCTestSubmitCommand.cxx 1.13 1.14 cmCTestSubmitCommand.h 1.6 1.7 cmCTestSubmitHandler.cxx 1.32 1.33 cmCTestSubmitHandler.h 1.5 1.6

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jan 12 10:38:29 EST 2009


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

Modified Files:
	cmCTestSubmitCommand.cxx cmCTestSubmitCommand.h 
	cmCTestSubmitHandler.cxx cmCTestSubmitHandler.h 
Log Message:
ENH: Teach ctest_submit about parts

This adds a PARTS option to the ctest_submit command which tells it to
submit only parts whose names are listed with the option.


Index: cmCTestSubmitHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C 2 -d -r1.5 -r1.6
*** cmCTestSubmitHandler.h	29 Feb 2008 19:58:33 -0000	1.5
--- cmCTestSubmitHandler.h	12 Jan 2009 15:38:27 -0000	1.6
***************
*** 40,44 ****
  
    void Initialize();
!   
  private:
    void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
--- 40,46 ----
  
    void Initialize();
! 
!   /** Specify a set of parts (by name) to submit.  */
!   void SelectParts(std::set<cmCTest::Part> const& parts);
  private:
    void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
***************
*** 78,81 ****
--- 80,84 ----
    int           FTPProxyType;
    std::ostream* LogFile;
+   bool SubmitPart[cmCTest::PartCount];
    bool CDash;
  };

Index: cmCTestSubmitCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitCommand.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmCTestSubmitCommand.h	12 May 2008 13:11:51 -0000	1.6
--- cmCTestSubmitCommand.h	12 Jan 2009 15:38:27 -0000	1.7
***************
*** 19,22 ****
--- 19,23 ----
  
  #include "cmCTestHandlerCommand.h"
+ #include "cmCTest.h"
  
  /** \class cmCTestSubmit
***************
*** 62,67 ****
      {
      return
!       "  ctest_submit([RETURN_VALUE res])\n"
!       "Submits the test results for the project.";
      }
  
--- 63,70 ----
      {
      return
!       "  ctest_submit([RETURN_VALUE res] [PARTS ...])\n"
!       "Submits the test results for the project.  "
!       "By default all available parts are submitted.  "
!       "The PARTS option lists a subset of parts to be submitted.";
      }
  
***************
*** 70,73 ****
--- 73,85 ----
  protected:
    cmCTestGenericHandler* InitializeHandler();
+ 
+   virtual bool CheckArgumentKeyword(std::string const& arg);
+   virtual bool CheckArgumentValue(std::string const& arg);
+   enum
+   {
+     ArgumentDoingParts = Superclass::ArgumentDoingLast1,
+     ArgumentDoingLast2
+   };
+   std::set<cmCTest::Part> Parts;
  };
  

Index: cmCTestSubmitHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -C 2 -d -r1.32 -r1.33
*** cmCTestSubmitHandler.cxx	12 Jan 2009 15:37:55 -0000	1.32
--- cmCTestSubmitHandler.cxx	12 Jan 2009 15:38:27 -0000	1.33
***************
*** 70,73 ****
--- 70,80 ----
    this->FTPProxyType = 0;
    this->CDash = false;
+ 
+   // We submit all available parts by default.
+   for(cmCTest::Part p = cmCTest::PartStart;
+       p != cmCTest::PartCount; p = cmCTest::Part(p+1))
+     {
+     this->SubmitPart[p] = true;
+     }
  }
  
***************
*** 894,897 ****
--- 901,911 ----
        p != cmCTest::PartCount; p = cmCTest::Part(p+1))
      {
+     // Skip parts we are not submitting.
+     if(!this->SubmitPart[p])
+       {
+       continue;
+       }
+ 
+     // Submit files from this part.
      std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p);
      for(std::vector<std::string>::const_iterator pi = pfiles.begin();
***************
*** 1108,1110 ****
  }
  
! 
--- 1122,1133 ----
  }
  
! //----------------------------------------------------------------------------
! void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts)
! {
!   // Check whether each part is selected.
!   for(cmCTest::Part p = cmCTest::PartStart;
!       p != cmCTest::PartCount; p = cmCTest::Part(p+1))
!     {
!     this->SubmitPart[p] = (parts.find(p) != parts.end());
!     }
! }

Index: cmCTestSubmitCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitCommand.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -C 2 -d -r1.13 -r1.14
*** cmCTestSubmitCommand.cxx	29 Mar 2006 17:33:41 -0000	1.13
--- cmCTestSubmitCommand.cxx	12 Jan 2009 15:38:27 -0000	1.14
***************
*** 19,22 ****
--- 19,23 ----
  #include "cmCTest.h"
  #include "cmCTestGenericHandler.h"
+ #include "cmCTestSubmitHandler.h"
  
  cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
***************
*** 107,112 ****
--- 108,158 ----
      return 0;
      }
+ 
+   // If a PARTS option was given, select only the named parts for submission.
+   if(!this->Parts.empty())
+     {
+     static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts);
+     }
    return handler;
  }
  
  
+ 
+ //----------------------------------------------------------------------------
+ bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
+ {
+   // Look for arguments specific to this command.
+   if(arg == "PARTS")
+     {
+     this->ArgumentDoing = ArgumentDoingParts;
+     return true;
+     }
+ 
+   // Look for other arguments.
+   return this->Superclass::CheckArgumentKeyword(arg);
+ }
+ 
+ //----------------------------------------------------------------------------
+ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
+ {
+   // Handle states specific to this command.
+   if(this->ArgumentDoing == ArgumentDoingParts)
+     {
+     cmCTest::Part p = this->CTest->GetPartFromName(arg.c_str());
+     if(p != cmCTest::PartCount)
+       {
+       this->Parts.insert(p);
+       }
+     else
+       {
+       cmOStringStream e;
+       e << "Part name \"" << arg << "\" is invalid.";
+       this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+       this->ArgumentDoing = ArgumentDoingError;
+       }
+     return true;
+     }
+ 
+   // Look for other arguments.
+   return this->Superclass::CheckArgumentValue(arg);
+ }



More information about the Cmake-commits mailing list