summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestSubmitHandler.cxx
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2009-12-11 19:10:37 (GMT)
committerZach Mullen <zach.mullen@kitware.com>2009-12-11 19:10:37 (GMT)
commitb2e7da885d44c56c48a61d89a34f66b6f514e52e (patch)
treefebacfbcf3d90ebf499da879cf8321ebdae51be0 /Source/CTest/cmCTestSubmitHandler.cxx
parent146cb98cb0d5d6f7348e8d7c3c9087c8b5aa49bc (diff)
downloadCMake-b2e7da885d44c56c48a61d89a34f66b6f514e52e.zip
CMake-b2e7da885d44c56c48a61d89a34f66b6f514e52e.tar.gz
CMake-b2e7da885d44c56c48a61d89a34f66b6f514e52e.tar.bz2
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.
Diffstat (limited to 'Source/CTest/cmCTestSubmitHandler.cxx')
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx57
1 files changed, 53 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index cbef1f1..7b4f38b 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -72,6 +72,8 @@ void cmCTestSubmitHandler::Initialize()
this->SubmitPart[p] = true;
}
this->CDash = false;
+ this->HasWarnings = false;
+ this->HasErrors = false;
this->Superclass::Initialize();
this->HTTPProxy = "";
this->HTTPProxyType = 0;
@@ -309,7 +311,12 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
}
}
}
-
+ 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);
@@ -409,6 +416,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
+ this->ParseResponse(chunk);
}
if ( chunkDebug.size() > 0 )
{
@@ -455,6 +463,36 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
}
//----------------------------------------------------------------------------
+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,
const cmStdString& remoteprefix,
@@ -1149,9 +1187,20 @@ int cmCTestSubmitHandler::ProcessHandler()
return -1;
}
}
- cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
- << std::endl);
- ofs << " Submission successful" << std::endl;
+ 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;
}
else if ( dropMethod == "xmlrpc" )