[Cmake-commits] [cmake-commits] zach.mullen committed cmCTestSubmitHandler.cxx 1.49 1.50 cmCTestSubmitHandler.h 1.9 1.10

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Dec 11 14:10:38 EST 2009


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

Modified Files:
	cmCTestSubmitHandler.cxx cmCTestSubmitHandler.h 
Log Message:
Added a "-http1.0" option to ctest to make it submit using curl's http 1.0 option.  Also added parsing of html reponse output to determine whether errors or warnings were sent in response from the server.  If errors or warnings occurred, the response is output to stdout, and the "submission successful" message has been changed to accurately reflect whether or not warnings or errors were returned with the response.


Index: cmCTestSubmitHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C 2 -d -r1.9 -r1.10
*** cmCTestSubmitHandler.h	28 Sep 2009 15:43:02 -0000	1.9
--- cmCTestSubmitHandler.h	11 Dec 2009 19:10:36 -0000	1.10
***************
*** 76,79 ****
--- 76,81 ----
                         const cmStdString& url);
  
+   void ParseResponse(std::vector<char>);
+ 
    std::string GetSubmitResultsPrefix();
  
***************
*** 86,89 ****
--- 88,93 ----
    bool SubmitPart[cmCTest::PartCount];
    bool CDash;
+   bool HasWarnings;
+   bool HasErrors;
    cmCTest::SetOfStrings Files;
  };

Index: cmCTestSubmitHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestSubmitHandler.cxx,v
retrieving revision 1.49
retrieving revision 1.50
diff -C 2 -d -r1.49 -r1.50
*** cmCTestSubmitHandler.cxx	28 Sep 2009 15:43:02 -0000	1.49
--- cmCTestSubmitHandler.cxx	11 Dec 2009 19:10:35 -0000	1.50
***************
*** 73,76 ****
--- 73,78 ----
      }
    this->CDash = false;
+   this->HasWarnings = false;
+   this->HasErrors = false;
    this->Superclass::Initialize();
    this->HTTPProxy = "";
***************
*** 310,314 ****
            }
          }
! 
        /* enable uploading */
        curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
--- 312,321 ----
            }
          }
!       if(this->CTest->ShouldUseHTTP10())
!         {
!         curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
!         }
!       // enable HTTP ERROR parsing
!       curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
        /* enable uploading */
        curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
***************
*** 410,413 ****
--- 417,421 ----
            << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
            << std::endl);
+         this->ParseResponse(chunk);
          }
        if ( chunkDebug.size() > 0 )
***************
*** 456,459 ****
--- 464,497 ----
  
  //----------------------------------------------------------------------------
+ void cmCTestSubmitHandler
+ ::ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk)
+ {
+   std::string output = "";
+ 
+   for(cmCTestSubmitHandlerVectorOfChar::iterator i = chunk.begin();
+       i != chunk.end(); ++i)
+     {
+     output += *i;
+     }
+   output = cmSystemTools::UpperCase(output);
+   
+   if(output.find("WARNING") != std::string::npos)
+     {
+     this->HasWarnings = true;
+     }
+   if(output.find("ERROR") != std::string::npos)
+     {
+     this->HasErrors = true;
+     }
+   
+   if(this->HasWarnings || this->HasErrors)
+     {
+     cmCTestLog(this->CTest, HANDLER_OUTPUT, "   Server Response:\n" <<
+           cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "\n");
+     }
+   
+ }
+ 
+ //----------------------------------------------------------------------------
  bool cmCTestSubmitHandler::TriggerUsingHTTP(
    const std::set<cmStdString>& files,
***************
*** 1150,1156 ****
          }
        }
!     cmCTestLog(this->CTest, HANDLER_OUTPUT, "   Submission successful"
!                << std::endl);
!     ofs << "   Submission successful" << std::endl;
      return 0;
      }
--- 1188,1205 ----
          }
        }
!     if(this->HasErrors)
!       {
!       cmCTestLog(this->CTest, HANDLER_OUTPUT, "   Errors occurred during "
!         "submission." << std::endl);
!       ofs << "   Errors occurred during submission. " << std::endl;
!       }
!     else
!       {
!       cmCTestLog(this->CTest, HANDLER_OUTPUT, "   Submission successful" <<
!         (this->HasWarnings ? ", with warnings." : "") << std::endl);
!       ofs << "   Submission successful" << 
!         (this->HasWarnings ? ", with warnings." : "") << std::endl;
!       }
! 
      return 0;
      }



More information about the Cmake-commits mailing list