[Cmake-commits] [cmake-commits] hoffman committed cmCTestSubmitHandler.cxx 1.39 1.40 cmCTestSubmitHandler.h 1.7 1.8

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Mar 31 15:24:52 EDT 2009


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

Modified Files:
	cmCTestSubmitHandler.cxx cmCTestSubmitHandler.h 
Log Message:
ENH: add submit via cp mode


Index: cmCTestSubmitHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** cmCTestSubmitHandler.h	3 Feb 2009 16:52:54 -0000	1.7
--- cmCTestSubmitHandler.h	31 Mar 2009 19:24:50 -0000	1.8
***************
*** 67,70 ****
--- 67,75 ----
                        const cmStdString& url);
  
+   bool SubmitUsingCP( const cmStdString& localprefix, 
+                       const std::set<cmStdString>& files,
+                       const cmStdString& remoteprefix, 
+                       const cmStdString& url);
+ 
    bool TriggerUsingHTTP(const std::set<cmStdString>& files,
                          const cmStdString& remoteprefix, 

Index: cmCTestSubmitHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.cxx,v
retrieving revision 1.39
retrieving revision 1.40
diff -C 2 -d -r1.39 -r1.40
*** cmCTestSubmitHandler.cxx	12 Mar 2009 18:54:00 -0000	1.39
--- cmCTestSubmitHandler.cxx	31 Mar 2009 19:24:50 -0000	1.40
***************
*** 255,258 ****
--- 255,259 ----
      if(curl)
        {
+       curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  
        // Using proxy
***************
*** 425,429 ****
    CURL *curl;
    char error_buffer[1024];
- 
    /* In windows, this will init the winsock stuff */
    ::curl_global_init(CURL_GLOBAL_ALL);
--- 426,429 ----
***************
*** 507,510 ****
--- 507,511 ----
        cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "   Trigger url: "
          << turl.c_str() << std::endl);
+       curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_easy_setopt(curl, CURLOPT_URL, turl.c_str());
        if ( curl_easy_perform(curl) )
***************
*** 658,661 ****
--- 659,703 ----
  
  //----------------------------------------------------------------------------
+ bool cmCTestSubmitHandler::SubmitUsingCP(
+   const cmStdString& localprefix,
+   const std::set<cmStdString>& files,
+   const cmStdString& remoteprefix,
+   const cmStdString& destination)
+ {
+   if ( !localprefix.size() ||
+     !files.size() || !remoteprefix.size() || !destination.size() )
+     { 
+     cmCTestLog(this->CTest, ERROR_MESSAGE, 
+                "Missing arguments for submit via cp:\n"
+                << "\tlocalprefix: " << localprefix << "\n"
+                << "\tNumber of files: " << files.size() << "\n"
+                << "\tremoteprefix: " << remoteprefix << "\n"
+                << "\tdestination: " << destination << std::endl);
+     return 0;
+     }
+   cmCTest::SetOfStrings::const_iterator file;
+   bool problems = false;
+   for ( file = files.begin(); file != files.end(); ++file )
+     {
+     std::string lfname = localprefix;
+     cmSystemTools::ConvertToUnixSlashes(lfname);
+     lfname += "/" + *file;
+     std::string rfname = destination + "/" + remoteprefix + *file;
+     cmSystemTools::CopyFileAlways(lfname.c_str(), rfname.c_str());
+     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "   Copy file: "
+         << lfname.c_str() << " to "
+         << rfname.c_str() << std::endl);
+     }
+   std::string tagDoneFile = destination + "/" + remoteprefix + "DONE";
+   cmSystemTools::Touch(tagDoneFile.c_str(), true);
+   if ( problems )
+     {
+     return false;
+     }
+   return true;
+ }
+ 
+ 
+ //----------------------------------------------------------------------------
  bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
    const std::set<cmStdString>& files,
***************
*** 937,941 ****
        }
      }
- 
    cmCTestLog(this->CTest, HANDLER_OUTPUT, "Submit files (using "
      << this->CTest->GetCTestConfiguration("DropMethod") << ")"
--- 979,982 ----
***************
*** 988,992 ****
        ofs << "   Problems when submitting via FTP" << std::endl;
        return -1;
!       }
      if(!this->CDash)
        {
--- 1029,1033 ----
        ofs << "   Problems when submitting via FTP" << std::endl;
        return -1;
!       } 
      if(!this->CDash)
        {
***************
*** 1120,1123 ****
--- 1161,1197 ----
      return 0;
      }
+   else if ( dropMethod == "cp" )
+     {
+     std::string location
+       = this->CTest->GetCTestConfiguration("DropLocation");
+     
+ 
+     // change to the build directory so that we can uses a relative path
+     // on windows since scp dosn't support "c:" a drive in the path
+     std::string 
+       oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory();
+     cmSystemTools::ChangeDirectory(buildDirectory.c_str());
+     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "   Change directory: "
+                << buildDirectory.c_str() << std::endl);
+ 
+     if ( !this->SubmitUsingCP(
+            "Testing/"+this->CTest->GetCurrentTag(), 
+            files, 
+            prefix, 
+            location) )
+       {
+       cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str());
+       cmCTestLog(this->CTest, ERROR_MESSAGE,
+         "   Problems when submitting via CP"
+         << std::endl);
+       ofs << "   Problems when submitting via cp" << std::endl;
+       return -1;
+       }
+     cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str());
+     cmCTestLog(this->CTest, HANDLER_OUTPUT, "   Submission successful"
+       << std::endl);
+     ofs << "   Submission successful" << std::endl;
+     return 0;
+     }
  
    cmCTestLog(this->CTest, ERROR_MESSAGE, "   Unknown submission method: \""



More information about the Cmake-commits mailing list