summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-09 15:54:45 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-01-09 15:54:54 (GMT)
commit38234058ff68d3e28b8c4672033dd118127581be (patch)
tree755dc2af8a79580e45f3b12e03955b39783f2543
parent7557a722a5126bef9ac6f5802b62be959a422910 (diff)
parent20adf8cfce62e2af7bfae4d70957d6b44a94e9a2 (diff)
downloadCMake-38234058ff68d3e28b8c4672033dd118127581be.zip
CMake-38234058ff68d3e28b8c4672033dd118127581be.tar.gz
CMake-38234058ff68d3e28b8c4672033dd118127581be.tar.bz2
Merge topic 'ctest-cli-http-headers'
20adf8cfce ctest: allow HTTP headers via command line Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9123
-rw-r--r--Help/manual/ctest.1.rst10
-rw-r--r--Help/release/dev/ctest-cli-http-headers.rst5
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx13
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h14
-rw-r--r--Source/ctest.cxx3
5 files changed, 43 insertions, 2 deletions
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 0917191..1924d4f 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -754,6 +754,16 @@ The available ``<dashboard-options>`` are the following:
This option will submit extra files to the dashboard.
+.. option:: --http-header <header>
+
+ .. versionadded:: 3.29
+
+ Append HTTP header when submitting to the dashboard.
+
+ This option will cause CTest to append the specified header
+ when submitting to the dashboard.
+ This option may be specified more than once.
+
.. option:: --http1.0
Submit using `HTTP 1.0`.
diff --git a/Help/release/dev/ctest-cli-http-headers.rst b/Help/release/dev/ctest-cli-http-headers.rst
new file mode 100644
index 0000000..81d4c7b
--- /dev/null
+++ b/Help/release/dev/ctest-cli-http-headers.rst
@@ -0,0 +1,5 @@
+ctest-cli-http-headers
+----------------------
+
+* :manual:`ctest(1)` gained a :option:`--http-header <ctest --http-header>`
+ option to add custom headers on submission to CDash.
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 77af889..db8a054 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -138,6 +138,19 @@ void cmCTestSubmitHandler::Initialize()
this->Files.clear();
}
+int cmCTestSubmitHandler::ProcessCommandLineArguments(
+ const std::string& currentArg, size_t& idx,
+ const std::vector<std::string>& allArgs)
+{
+ if (cmHasLiteralPrefix(currentArg, "--http-header") &&
+ idx < allArgs.size() - 1) {
+ ++idx;
+ this->HttpHeaders.push_back(allArgs[idx]);
+ this->CommandLineHttpHeaders.push_back(allArgs[idx]);
+ }
+ return 1;
+}
+
bool cmCTestSubmitHandler::SubmitUsingHTTP(
const std::string& localprefix, const std::vector<std::string>& files,
const std::string& remoteprefix, const std::string& url)
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index 0c7253c..e8eb38a 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -4,6 +4,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <iosfwd>
#include <set>
#include <string>
@@ -33,6 +34,11 @@ public:
void Initialize() override;
+ //! Set all the submit arguments
+ int ProcessCommandLineArguments(
+ const std::string& currentArg, size_t& idx,
+ const std::vector<std::string>& allArgs) override;
+
/** Specify a set of parts (by name) to submit. */
void SelectParts(std::set<cmCTest::Part> const& parts);
@@ -44,7 +50,12 @@ public:
void SetHttpHeaders(std::vector<std::string> const& v)
{
- this->HttpHeaders = v;
+ if (this->CommandLineHttpHeaders.empty()) {
+ this->HttpHeaders = v;
+ } else {
+ this->HttpHeaders = this->CommandLineHttpHeaders;
+ this->HttpHeaders.insert(this->HttpHeaders.end(), v.begin(), v.end());
+ }
}
private:
@@ -75,5 +86,6 @@ private:
bool HasWarnings;
bool HasErrors;
std::set<std::string> Files;
+ std::vector<std::string> CommandLineHttpHeaders;
std::vector<std::string> HttpHeaders;
};
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index fa38a65..b2867e2 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -25,7 +25,7 @@ const cmDocumentationEntry cmDocumentationName = {
const cmDocumentationEntry cmDocumentationUsage = { {}, " ctest [options]" };
-const cmDocumentationEntry cmDocumentationOptions[74] = {
+const cmDocumentationEntry cmDocumentationOptions[] = {
{ "--preset <preset>, --preset=<preset>",
"Read arguments from a test preset." },
{ "--list-presets", "List available test presets." },
@@ -143,6 +143,7 @@ const cmDocumentationEntry cmDocumentationOptions[74] = {
{ "--tomorrow-tag", "Nightly or experimental starts with next day tag." },
{ "--overwrite", "Overwrite CTest configuration option." },
{ "--extra-submit <file>[;<file>]", "Submit extra files to the dashboard." },
+ { "--http-header <header>", "Append HTTP header when submitting" },
{ "--force-new-ctest-process",
"Run child CTest instances as new processes" },
{ "--schedule-random", "Use a random order for scheduling tests" },