diff options
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 57 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.h | 4 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 8 | ||||
-rw-r--r-- | Source/cmCTest.h | 4 |
4 files changed, 67 insertions, 6 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" ) diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index d93f94d..8b011ea 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -75,6 +75,8 @@ private: const cmStdString& remoteprefix, const cmStdString& url); + void ParseResponse(std::vector<char>); + std::string GetSubmitResultsPrefix(); cmStdString HTTPProxy; @@ -85,6 +87,8 @@ private: std::ostream* LogFile; bool SubmitPart[cmCTest::PartCount]; bool CDash; + bool HasWarnings; + bool HasErrors; cmCTest::SetOfStrings Files; }; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index ee249b2..7e3a81b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -220,6 +220,7 @@ cmCTest::cmCTest() this->ProduceXML = false; this->ShowOnly = false; this->RunConfigurationScript = false; + this->UseHTTP10 = false; this->TestModel = cmCTest::EXPERIMENTAL; this->MaxTestNameWidth = 30; this->InteractiveDebugMode = true; @@ -1704,7 +1705,12 @@ void cmCTest::HandleCommandLineArguments(size_t &i, 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++; double timeout = (double)atof(args[i].c_str()); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 299dbc8..983202a 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -193,6 +193,8 @@ public: ///! Should we only show what we would do? bool GetShowOnly(); + bool ShouldUseHTTP10() { return this->UseHTTP10; } + //Used for parallel ctest job scheduling std::string GetScheduleType() { return this->ScheduleType; } void SetScheduleType(std::string type) { this->ScheduleType = type; } @@ -384,7 +386,7 @@ private: bool ExtraVerbose; bool ProduceXML; bool LabelSummary; - + bool UseHTTP10; bool Failover; bool BatchJobs; |