summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikhil Reddy Ramolla <rnr1410@gmail.com>2021-10-01 19:10:55 (GMT)
committerBrad King <brad.king@kitware.com>2021-10-14 15:41:44 (GMT)
commit5d178fcc53d0075bb6f6d93a862b67c66a0d1add (patch)
tree025a94475460d28fb207363ff7df21da0d99d0d6
parent1c12694124aedc0f7cf5a98e635e27d4c338fce0 (diff)
downloadCMake-5d178fcc53d0075bb6f6d93a862b67c66a0d1add.zip
CMake-5d178fcc53d0075bb6f6d93a862b67c66a0d1add.tar.gz
CMake-5d178fcc53d0075bb6f6d93a862b67c66a0d1add.tar.bz2
CTest: Add CTEST_SUBMIT_INACTIVITY_TIMEOUT variable
Fixes: #22617
-rw-r--r--Auxiliary/vim/syntax/cmake.vim1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/manual/ctest.1.rst7
-rw-r--r--Help/release/dev/ctest_submit-inactivity-timeout.rst5
-rw-r--r--Help/variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT.rst5
-rw-r--r--Modules/DartConfiguration.tcl.in1
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx3
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx33
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h1
9 files changed, 54 insertions, 3 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 7a3e4ed..e09ecf3 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -1608,6 +1608,7 @@ syn keyword cmakeVariable contained
\ CTEST_SCP_COMMAND
\ CTEST_SITE
\ CTEST_SOURCE_DIRECTORY
+ \ CTEST_SUBMIT_INACTIVITY_TIMEOUT
\ CTEST_SUBMIT_URL
\ CTEST_SVN_COMMAND
\ CTEST_SVN_OPTIONS
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index a2103f7..ad96c09 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -665,6 +665,7 @@ Variables for CTest
/variable/CTEST_SCP_COMMAND
/variable/CTEST_SCRIPT_DIRECTORY
/variable/CTEST_SITE
+ /variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT
/variable/CTEST_SUBMIT_URL
/variable/CTEST_SOURCE_DIRECTORY
/variable/CTEST_SVN_COMMAND
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 03d8bf6..52e8009 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -1349,6 +1349,13 @@ Configuration settings include:
* :module:`CTest` module variable: ``SUBMIT_URL`` if set,
else ``CTEST_SUBMIT_URL``
+``SubmitInactivityTimeout``
+ The time to wait for the submission after which it is canceled
+ if not completed. Specify a zero value to disable timeout.
+
+ * `CTest Script`_ variable: :variable:`CTEST_SUBMIT_INACTIVITY_TIMEOUT`
+ * :module:`CTest` module variable: ``CTEST_SUBMIT_INACTIVITY_TIMEOUT``
+
``TriggerSite``
Legacy option. Not used.
diff --git a/Help/release/dev/ctest_submit-inactivity-timeout.rst b/Help/release/dev/ctest_submit-inactivity-timeout.rst
new file mode 100644
index 0000000..3d4c408
--- /dev/null
+++ b/Help/release/dev/ctest_submit-inactivity-timeout.rst
@@ -0,0 +1,5 @@
+ctest_submit-inactivity-timeout
+-------------------------------
+
+* :manual:`ctest(1)` gained a new :variable:`CTEST_SUBMIT_INACTIVITY_TIMEOUT`
+ variable, which can be used to specify a timeout for submission inactivity.
diff --git a/Help/variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT.rst b/Help/variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT.rst
new file mode 100644
index 0000000..65976fa
--- /dev/null
+++ b/Help/variable/CTEST_SUBMIT_INACTIVITY_TIMEOUT.rst
@@ -0,0 +1,5 @@
+CTEST_SUBMIT_INACTIVITY_TIMEOUT
+-------------------------------
+
+Specify the CTest ``SubmitInactivityTimeout`` setting
+in a :manual:`ctest(1)` dashboard client script.
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index e5b1e5d..afa36f7 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -21,6 +21,7 @@ LabelsForSubprojects: @CTEST_LABELS_FOR_SUBPROJECTS@
# Submission information
SubmitURL: @SUBMIT_URL@
+SubmitInactivityTimeout: @CTEST_SUBMIT_INACTIVITY_TIMEOUT@
# Dashboard start time
NightlyStartTime: @NIGHTLY_START_TIME@
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index c4f87e9..a2dc615 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -58,6 +58,9 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet);
+ this->CTest->SetCTestConfigurationFromCMakeVariable(
+ this->Makefile, "SubmitInactivityTimeout",
+ "CTEST_SUBMIT_INACTIVITY_TIMEOUT", this->Quiet);
cmValue notesFilesVariable =
this->Makefile->GetDefinition("CTEST_NOTES_FILES");
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());
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index 809c615..0c7253c 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -63,6 +63,7 @@ private:
void ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk);
std::string GetSubmitResultsPrefix();
+ int GetSubmitInactivityTimeout();
class ResponseParser;