diff options
author | Nikhil Reddy Ramolla <rnr1410@gmail.com> | 2021-10-01 19:10:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-10-14 15:41:44 (GMT) |
commit | 5d178fcc53d0075bb6f6d93a862b67c66a0d1add (patch) | |
tree | 025a94475460d28fb207363ff7df21da0d99d0d6 /Source/CTest/cmCTestSubmitHandler.cxx | |
parent | 1c12694124aedc0f7cf5a98e635e27d4c338fce0 (diff) | |
download | CMake-5d178fcc53d0075bb6f6d93a862b67c66a0d1add.zip CMake-5d178fcc53d0075bb6f6d93a862b67c66a0d1add.tar.gz CMake-5d178fcc53d0075bb6f6d93a862b67c66a0d1add.tar.bz2 |
CTest: Add CTEST_SUBMIT_INACTIVITY_TIMEOUT variable
Fixes: #22617
Diffstat (limited to 'Source/CTest/cmCTestSubmitHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index b99bb79..fae5e30 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -7,6 +7,7 @@ #include <cstdlib> #include <sstream> +#include <cm/iomanip> #include <cmext/algorithm> #include <cm3p/curl/curl.h> @@ -216,8 +217,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( // if there is little to no activity for too long stop submitting ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1); - ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, - SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT); + auto submitInactivityTimeout = this->GetSubmitInactivityTimeout(); + if (submitInactivityTimeout != 0) { + ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, + submitInactivityTimeout); + } /* HTTP PUT please */ ::curl_easy_setopt(curl, CURLOPT_PUT, 1); @@ -499,7 +503,10 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector<std::string> args = cmExpandedList(curlopt); curl.SetCurlOptions(args); - curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT); + auto submitInactivityTimeout = this->GetSubmitInactivityTimeout(); + if (submitInactivityTimeout != 0) { + curl.SetTimeOutSeconds(submitInactivityTimeout); + } curl.SetHttpHeaders(this->HttpHeaders); std::string url = this->CTest->GetSubmitURL(); if (!cmHasLiteralPrefix(url, "http://") && @@ -893,6 +900,26 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts) } } +int cmCTestSubmitHandler::GetSubmitInactivityTimeout() +{ + int submitInactivityTimeout = SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT; + std::string const& timeoutStr = + this->CTest->GetCTestConfiguration("SubmitInactivityTimeout"); + if (!timeoutStr.empty()) { + unsigned long timeout; + if (cmStrToULong(timeoutStr, &timeout)) { + submitInactivityTimeout = static_cast<int>(timeout); + } else { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "SubmitInactivityTimeout is invalid: " + << cm::quoted(timeoutStr) << "." + << " Using a default value of " + << SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT << "." << std::endl); + } + } + return submitInactivityTimeout; +} + void cmCTestSubmitHandler::SelectFiles(std::set<std::string> const& files) { this->Files.insert(files.begin(), files.end()); |