Merge branch 'cdash_checksum_400' into release-3.26

Merge-request: !8648
This commit is contained in:
Brad King
2023-07-25 09:13:53 -04:00
2 changed files with 13 additions and 10 deletions

View File

@@ -142,7 +142,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
const std::string& remoteprefix, const std::string& url)
{
CURL* curl;
CURLcode res;
FILE* ftpfile;
char error_buffer[1024];
// Set Content-Type to satisfy fussy modsecurity rules.
@@ -210,8 +209,6 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
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);
@@ -285,7 +282,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
upload_as += "&MD5=";
if (cmIsOn(this->GetOption("InternalTest"))) {
upload_as += "bad_md5sum";
upload_as += "ffffffffffffffffffffffffffffffff";
} else {
upload_as +=
cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5);
@@ -337,7 +334,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &chunkDebug);
// Now run off and do what you've been told!
res = ::curl_easy_perform(curl);
::curl_easy_perform(curl);
if (!chunk.empty()) {
cmCTestOptionalLog(this->CTest, DEBUG,
@@ -358,7 +355,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
// If curl failed for any reason, or checksum fails, wait and retry
//
if (res != CURLE_OK || this->HasErrors) {
long response_code;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
bool successful_submission = response_code == 200;
if (!successful_submission || this->HasErrors) {
std::string retryDelay = *this->GetOption("RetryDelay");
std::string retryCount = *this->GetOption("RetryCount");
@@ -396,7 +397,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
chunkDebug.clear();
this->HasErrors = false;
res = ::curl_easy_perform(curl);
::curl_easy_perform(curl);
if (!chunk.empty()) {
cmCTestOptionalLog(this->CTest, DEBUG,
@@ -407,14 +408,16 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
this->ParseResponse(chunk);
}
if (res == CURLE_OK && !this->HasErrors) {
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
if (response_code == 200 && !this->HasErrors) {
successful_submission = true;
break;
}
}
}
fclose(ftpfile);
if (res) {
if (!successful_submission) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
" Error when uploading file: " << local_file
<< std::endl);

View File

@@ -3304,7 +3304,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/CTestTestChecksum/testOutput.log"
)
set_tests_properties(CTestTestChecksum PROPERTIES PASS_REGULAR_EXPRESSION
"Submission failed: Checksum failed for file")
"md5 mismatch")
# these tests take a long time, make sure they have it
# if timeouts have not already been set