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.
This commit is contained in:
parent
146cb98cb0
commit
b2e7da885d
|
@ -72,6 +72,8 @@ void cmCTestSubmitHandler::Initialize()
|
||||||
this->SubmitPart[p] = true;
|
this->SubmitPart[p] = true;
|
||||||
}
|
}
|
||||||
this->CDash = false;
|
this->CDash = false;
|
||||||
|
this->HasWarnings = false;
|
||||||
|
this->HasErrors = false;
|
||||||
this->Superclass::Initialize();
|
this->Superclass::Initialize();
|
||||||
this->HTTPProxy = "";
|
this->HTTPProxy = "";
|
||||||
this->HTTPProxyType = 0;
|
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 */
|
/* enable uploading */
|
||||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
|
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
|
||||||
|
|
||||||
|
@ -409,6 +416,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
|
||||||
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
|
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
|
||||||
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
|
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
|
this->ParseResponse(chunk);
|
||||||
}
|
}
|
||||||
if ( chunkDebug.size() > 0 )
|
if ( chunkDebug.size() > 0 )
|
||||||
{
|
{
|
||||||
|
@ -454,6 +462,36 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
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(
|
bool cmCTestSubmitHandler::TriggerUsingHTTP(
|
||||||
const std::set<cmStdString>& files,
|
const std::set<cmStdString>& files,
|
||||||
|
@ -1149,9 +1187,20 @@ int cmCTestSubmitHandler::ProcessHandler()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful"
|
if(this->HasErrors)
|
||||||
<< std::endl);
|
{
|
||||||
ofs << " Submission successful" << std::endl;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ( dropMethod == "xmlrpc" )
|
else if ( dropMethod == "xmlrpc" )
|
||||||
|
|
|
@ -75,6 +75,8 @@ private:
|
||||||
const cmStdString& remoteprefix,
|
const cmStdString& remoteprefix,
|
||||||
const cmStdString& url);
|
const cmStdString& url);
|
||||||
|
|
||||||
|
void ParseResponse(std::vector<char>);
|
||||||
|
|
||||||
std::string GetSubmitResultsPrefix();
|
std::string GetSubmitResultsPrefix();
|
||||||
|
|
||||||
cmStdString HTTPProxy;
|
cmStdString HTTPProxy;
|
||||||
|
@ -85,6 +87,8 @@ private:
|
||||||
std::ostream* LogFile;
|
std::ostream* LogFile;
|
||||||
bool SubmitPart[cmCTest::PartCount];
|
bool SubmitPart[cmCTest::PartCount];
|
||||||
bool CDash;
|
bool CDash;
|
||||||
|
bool HasWarnings;
|
||||||
|
bool HasErrors;
|
||||||
cmCTest::SetOfStrings Files;
|
cmCTest::SetOfStrings Files;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -220,6 +220,7 @@ cmCTest::cmCTest()
|
||||||
this->ProduceXML = false;
|
this->ProduceXML = false;
|
||||||
this->ShowOnly = false;
|
this->ShowOnly = false;
|
||||||
this->RunConfigurationScript = false;
|
this->RunConfigurationScript = false;
|
||||||
|
this->UseHTTP10 = false;
|
||||||
this->TestModel = cmCTest::EXPERIMENTAL;
|
this->TestModel = cmCTest::EXPERIMENTAL;
|
||||||
this->MaxTestNameWidth = 30;
|
this->MaxTestNameWidth = 30;
|
||||||
this->InteractiveDebugMode = true;
|
this->InteractiveDebugMode = true;
|
||||||
|
@ -1704,7 +1705,12 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
|
||||||
this->SetParallelLevel(plevel);
|
this->SetParallelLevel(plevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->CheckArgument(arg, "--timeout") && i < args.size() - 1)
|
if(this->CheckArgument(arg, "--http1.0"))
|
||||||
|
{
|
||||||
|
this->UseHTTP10 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this->CheckArgument(arg, "--timeout") && i < args.size() - 1)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
double timeout = (double)atof(args[i].c_str());
|
double timeout = (double)atof(args[i].c_str());
|
||||||
|
|
|
@ -193,6 +193,8 @@ public:
|
||||||
///! Should we only show what we would do?
|
///! Should we only show what we would do?
|
||||||
bool GetShowOnly();
|
bool GetShowOnly();
|
||||||
|
|
||||||
|
bool ShouldUseHTTP10() { return this->UseHTTP10; }
|
||||||
|
|
||||||
//Used for parallel ctest job scheduling
|
//Used for parallel ctest job scheduling
|
||||||
std::string GetScheduleType() { return this->ScheduleType; }
|
std::string GetScheduleType() { return this->ScheduleType; }
|
||||||
void SetScheduleType(std::string type) { this->ScheduleType = type; }
|
void SetScheduleType(std::string type) { this->ScheduleType = type; }
|
||||||
|
@ -384,7 +386,7 @@ private:
|
||||||
bool ExtraVerbose;
|
bool ExtraVerbose;
|
||||||
bool ProduceXML;
|
bool ProduceXML;
|
||||||
bool LabelSummary;
|
bool LabelSummary;
|
||||||
|
bool UseHTTP10;
|
||||||
bool Failover;
|
bool Failover;
|
||||||
bool BatchJobs;
|
bool BatchJobs;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue