Merge topic 'cdash_checksum_400'

b7c871f745 ctest: Update ctest_submit for CDash behavior change

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8648
This commit is contained in:
Brad King
2023-07-25 15:02:56 +00:00
committed by Kitware Robot
2 changed files with 13 additions and 10 deletions

View File

@@ -143,7 +143,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.
@@ -211,8 +210,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);
@@ -286,7 +283,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);
@@ -338,7 +335,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,
@@ -359,7 +356,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");
@@ -397,7 +398,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,
@@ -408,14 +409,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