[Cmake-commits] [cmake-commits] david.cole committed cmCTestSubmitCommand.cxx 1.14 1.15 cmCTestSubmitCommand.h 1.7 1.8 cmCTestSubmitHandler.cxx 1.36 1.37 cmCTestSubmitHandler.h 1.6 1.7

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 3 11:52:56 EST 2009


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

Modified Files:
	cmCTestSubmitCommand.cxx cmCTestSubmitCommand.h 
	cmCTestSubmitHandler.cxx cmCTestSubmitHandler.h 
Log Message:
ENH: Add FILES arg to the ctest_submit command. BUG: Propagate the IsCDash setting properly to the ctest configuration during a submit. Also, do not propagate TriggerSite for projects submitting to CDash. No triggers are necessary with CDash.


Index: cmCTestSubmitHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmCTestSubmitHandler.h	12 Jan 2009 15:38:27 -0000	1.6
--- cmCTestSubmitHandler.h	3 Feb 2009 16:52:54 -0000	1.7
***************
*** 43,46 ****
--- 43,50 ----
    /** Specify a set of parts (by name) to submit.  */
    void SelectParts(std::set<cmCTest::Part> const& parts);
+ 
+   /** Specify a set of files to submit.  */
+   void SelectFiles(cmCTest::SetOfStrings const& files);
+ 
  private:
    void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
***************
*** 82,85 ****
--- 86,90 ----
    bool SubmitPart[cmCTest::PartCount];
    bool CDash;
+   cmCTest::SetOfStrings Files;
  };
  

Index: cmCTestSubmitCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitCommand.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** cmCTestSubmitCommand.h	12 Jan 2009 15:38:27 -0000	1.7
--- cmCTestSubmitCommand.h	3 Feb 2009 16:52:54 -0000	1.8
***************
*** 31,35 ****
  public:
  
!   cmCTestSubmitCommand() {}
  
    /**
--- 31,39 ----
  public:
  
!   cmCTestSubmitCommand()
!     {
!     this->PartsMentioned = false;
!     this->FilesMentioned = false;
!     }
  
    /**
***************
*** 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.";
      }
  
--- 67,76 ----
      {
      return
!       "  ctest_submit([RETURN_VALUE res] [PARTS ...] [FILES ...])\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.  "
!       "The FILES option explicitly lists specific files to be submitted.  "
!       "Each individual file must exist at the time of the call.";
      }
  
***************
*** 76,85 ****
--- 82,97 ----
    virtual bool CheckArgumentKeyword(std::string const& arg);
    virtual bool CheckArgumentValue(std::string const& arg);
+ 
    enum
    {
      ArgumentDoingParts = Superclass::ArgumentDoingLast1,
+     ArgumentDoingFiles,
      ArgumentDoingLast2
    };
+ 
+   bool PartsMentioned;
    std::set<cmCTest::Part> Parts;
+   bool FilesMentioned;
+   cmCTest::SetOfStrings Files;
  };
  

Index: cmCTestSubmitHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -C 2 -d -r1.36 -r1.37
*** cmCTestSubmitHandler.cxx	27 Jan 2009 15:58:25 -0000	1.36
--- cmCTestSubmitHandler.cxx	3 Feb 2009 16:52:54 -0000	1.37
***************
*** 83,86 ****
--- 83,87 ----
    this->FTPProxyType = 0;
    this->LogFile = 0;
+   this->Files.clear();
  }
  
***************
*** 853,859 ****
--- 854,873 ----
    this->StartLogFile("Submit", ofs);
  
+   cmCTest::SetOfStrings files;
    std::string prefix = this->GetSubmitResultsPrefix();
+ 
+   if (!this->Files.empty())
+     {
+     // Submit only the explicitly selected files:
+     //
+     files.insert(this->Files.begin(), this->Files.end());
+     }
+ 
+   // Add to the list of files to submit from any selected, existing parts:
+   //
+ 
    // TODO:
    // Check if test is enabled
+ 
    this->CTest->AddIfExists(cmCTest::PartUpdate, "Update.xml");
    this->CTest->AddIfExists(cmCTest::PartConfigure, "Configure.xml");
***************
*** 890,894 ****
  
    // Query parts for files to submit.
-   cmCTest::SetOfStrings files;
    for(cmCTest::Part p = cmCTest::PartStart;
        p != cmCTest::PartCount; p = cmCTest::Part(p+1))
--- 904,907 ----
***************
*** 920,923 ****
--- 933,937 ----
        }
      }
+ 
    cmCTestLog(this->CTest, HANDLER_OUTPUT, "Submit files (using "
      << this->CTest->GetCTestConfiguration("DropMethod") << ")"
***************
*** 930,935 ****
      }
    this->SetLogFile(&ofs);
!   if ( this->CTest->GetCTestConfiguration("DropMethod") == "" ||
!     this->CTest->GetCTestConfiguration("DropMethod") ==  "ftp" )
      {
      ofs << "Using drop method: FTP" << std::endl;
--- 944,951 ----
      }
    this->SetLogFile(&ofs);
! 
!   cmStdString dropMethod(this->CTest->GetCTestConfiguration("DropMethod"));
! 
!   if ( dropMethod == "" || dropMethod == "ftp" )
      {
      ofs << "Using drop method: FTP" << std::endl;
***************
*** 991,995 ****
        }
      }
!   else if ( this->CTest->GetCTestConfiguration("DropMethod") == "http" )
      {
      ofs << "Using drop method: HTTP" << std::endl;
--- 1007,1011 ----
        }
      }
!   else if ( dropMethod == "http" )
      {
      ofs << "Using drop method: HTTP" << std::endl;
***************
*** 1046,1050 ****
      return 0;
      }
!   else if ( this->CTest->GetCTestConfiguration("DropMethod") == "xmlrpc" )
      {
      ofs << "Using drop method: XML-RPC" << std::endl;
--- 1062,1066 ----
      return 0;
      }
!   else if ( dropMethod == "xmlrpc" )
      {
      ofs << "Using drop method: XML-RPC" << std::endl;
***************
*** 1066,1070 ****
      return 0;
      }
!   else if ( this->CTest->GetCTestConfiguration("DropMethod") == "scp" )
      {
      std::string url;
--- 1082,1086 ----
      return 0;
      }
!   else if ( dropMethod == "scp" )
      {
      std::string url;
***************
*** 1101,1105 ****
  
    cmCTestLog(this->CTest, ERROR_MESSAGE, "   Unknown submission method: \""
!     << this->CTest->GetCTestConfiguration("DropMethod") << "\"" << std::endl);
    return -1;
  }
--- 1117,1121 ----
  
    cmCTestLog(this->CTest, ERROR_MESSAGE, "   Unknown submission method: \""
!     << dropMethod << "\"" << std::endl);
    return -1;
  }
***************
*** 1126,1127 ****
--- 1142,1149 ----
      }
  }
+ 
+ //----------------------------------------------------------------------------
+ void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files)
+ {
+   this->Files.insert(files.begin(), files.end());
+ }

Index: cmCTestSubmitCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitCommand.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -C 2 -d -r1.14 -r1.15
*** cmCTestSubmitCommand.cxx	12 Jan 2009 15:38:27 -0000	1.14
--- cmCTestSubmitCommand.cxx	3 Feb 2009 16:52:54 -0000	1.15
***************
*** 31,34 ****
--- 31,36 ----
    const char* ctestTriggerSite
      = this->Makefile->GetDefinition("CTEST_TRIGGER_SITE");
+   bool ctestDropSiteCDash
+     = this->Makefile->IsOn("CTEST_DROP_SITE_CDASH");
  
    if ( !ctestDropMethod )
***************
*** 36,59 ****
      ctestDropMethod = "http";
      }
!   if ( !ctestDropSite )
!     {
!     ctestDropSite = "public.kitware.com";
!     }
!   if ( !ctestDropLocation )
      {
!     ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi";
      }
!   if ( !ctestTriggerSite )
      {
!     ctestTriggerSite
!       = "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi";
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, "* Use default trigger site: "
!       << ctestTriggerSite << std::endl;);
      }
  
!   this->CTest->SetCTestConfiguration("DropMethod",   ctestDropMethod);
!   this->CTest->SetCTestConfiguration("DropSite",     ctestDropSite);
    this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation);
!   this->CTest->SetCTestConfiguration("TriggerSite",  ctestTriggerSite);
  
    this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
--- 38,94 ----
      ctestDropMethod = "http";
      }
! 
!   if ( ctestDropSiteCDash )
      {
!     // drop site is a CDash server...
!     //
!     if ( !ctestDropSite )
!       {
!       // error: CDash requires CTEST_DROP_SITE definition
!       // in CTestConfig.cmake
!       }
!     if ( !ctestDropLocation )
!       {
!       // error: CDash requires CTEST_DROP_LOCATION definition
!       // in CTestConfig.cmake
!       }
      }
!   else
      {
!     // drop site is a *NOT* a CDash server...
!     //
!     // Keep all this code in case anybody out there is still
!     // using newer CMake with non-CDash servers
!     //
!     if ( !ctestDropSite )
!       {
!       ctestDropSite = "public.kitware.com";
!       }
!     if ( !ctestDropLocation )
!       {
!       ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi";
!       }
!     if ( !ctestTriggerSite )
!       {
!       ctestTriggerSite
!         = "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi";
!       cmCTestLog(this->CTest, HANDLER_OUTPUT, "* Use default trigger site: "
!         << ctestTriggerSite << std::endl;);
!       }
      }
  
!   this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod);
!   this->CTest->SetCTestConfiguration("DropSite", ctestDropSite);
    this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation);
! 
!   this->CTest->SetCTestConfiguration("IsCDash",
!     ctestDropSiteCDash ? "TRUE" : "FALSE");
! 
!   // Only propagate TriggerSite for non-CDash projects:
!   //
!   if ( !ctestDropSiteCDash )
!     {
!     this->CTest->SetCTestConfiguration("TriggerSite",  ctestTriggerSite);
!     }
  
    this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
***************
*** 80,83 ****
--- 115,119 ----
      this->CTest->GenerateNotesFile(newNotesFiles);
      }
+ 
    const char* extraFilesVariable
      = this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
***************
*** 109,122 ****
      }
  
    // 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)
--- 145,186 ----
      }
  
+   // If no FILES or PARTS given, *all* PARTS are submitted by default.
+   //
+   // If FILES are given, but not PARTS, only the FILES are submitted
+   // and *no* PARTS are submitted.
+   //  (This is why we select the empty "noParts" set in the
+   //   FilesMentioned block below...)
+   //
+   // If PARTS are given, only the selected PARTS are submitted.
+   //
+   // If both PARTS and FILES are given, only the selected PARTS *and*
+   // all the given FILES are submitted.
+ 
+   // If given explicit FILES to submit, pass them to the handler.
+   //
+   if(this->FilesMentioned)
+     {
+     // Intentionally select *no* PARTS. (Pass an empty set.) If PARTS
+     // were also explicitly mentioned, they will be selected below...
+     // But FILES with no PARTS mentioned should just submit the FILES
+     // without any of the default parts.
+     //
+     std::set<cmCTest::Part> noParts;
+     static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(noParts);
+ 
+     static_cast<cmCTestSubmitHandler*>(handler)->SelectFiles(this->Files);
+     }
+ 
    // If a PARTS option was given, select only the named parts for submission.
!   //
!   if(this->PartsMentioned)
      {
      static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts);
      }
+ 
    return handler;
  }
  
  
  //----------------------------------------------------------------------------
  bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
***************
*** 126,129 ****
--- 190,201 ----
      {
      this->ArgumentDoing = ArgumentDoingParts;
+     this->PartsMentioned = true;
+     return true;
+     }
+ 
+   if(arg == "FILES")
+     {
+     this->ArgumentDoing = ArgumentDoingFiles;
+     this->FilesMentioned = true;
      return true;
      }
***************
*** 133,136 ****
--- 205,209 ----
  }
  
+ 
  //----------------------------------------------------------------------------
  bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
***************
*** 154,157 ****
--- 227,248 ----
      }
  
+   if(this->ArgumentDoing == ArgumentDoingFiles)
+     {
+     cmStdString filename(arg);
+     if(cmSystemTools::FileExists(filename.c_str()))
+       {
+       this->Files.insert(filename);
+       }
+     else
+       {
+       cmOStringStream e;
+       e << "File \"" << filename << "\" does not exist. Cannot submit "
+           << "a non-existent file.";
+       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