summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/ctest_submit.rst10
-rw-r--r--Help/release/dev/ctest_submit_get_buildid.rst6
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx33
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h28
-rw-r--r--Tests/RunCMake/ctest_submit/RunCMakeTest.cmake2
5 files changed, 55 insertions, 24 deletions
diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst
index ac9eac1..983fc20 100644
--- a/Help/command/ctest_submit.rst
+++ b/Help/command/ctest_submit.rst
@@ -7,6 +7,7 @@ Perform the :ref:`CTest Submit Step` as a :ref:`Dashboard Client`.
ctest_submit([PARTS <part>...] [FILES <file>...]
[SUBMIT_URL <url>]
+ [BUILD_ID <result-var>]
[HTTPHEADER <header>]
[RETRY_COUNT <count>]
[RETRY_DELAY <delay>]
@@ -44,6 +45,10 @@ The options are:
The ``http`` or ``https`` URL of the dashboard server to send the submission
to. If not given, the :variable:`CTEST_SUBMIT_URL` variable is used.
+``BUILD_ID <result-var>``
+ Store in the ``<result-var>`` variable the ID assigned to this build by
+ CDash.
+
``HTTPHEADER <HTTP-header>``
Specify HTTP header to be included in the request to CDash during submission.
For example, CDash can be configured to only accept submissions from
@@ -94,5 +99,6 @@ with a content hash of the file. If CDash does not already have the file,
then it is uploaded. Along with the file, a CDash type string is specified
to tell CDash which handler to use to process the data.
-This signature accepts the ``SUBMIT_URL``, ``HTTPHEADER``, ``RETRY_COUNT``,
-``RETRY_DELAY``, ``RETURN_VALUE`` and ``QUIET`` options as described above.
+This signature accepts the ``SUBMIT_URL``, ``BUILD_ID``, ``HTTPHEADER``,
+``RETRY_COUNT``, ``RETRY_DELAY``, ``RETURN_VALUE`` and ``QUIET`` options
+as described above.
diff --git a/Help/release/dev/ctest_submit_get_buildid.rst b/Help/release/dev/ctest_submit_get_buildid.rst
new file mode 100644
index 0000000..39a0010
--- /dev/null
+++ b/Help/release/dev/ctest_submit_get_buildid.rst
@@ -0,0 +1,6 @@
+ctest_submit_get_buildid
+--------------------------
+
+* The :command:`ctest_submit` command learned a new option: ``BUILD_ID``.
+ This can be used to store the ID assigned to this build by CDash to a
+ variable.
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index e31d982..afc3e67 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -12,6 +12,29 @@
class cmExecutionStatus;
+cmCTestSubmitCommand::cmCTestSubmitCommand()
+{
+ this->PartsMentioned = false;
+ this->FilesMentioned = false;
+ this->InternalTest = false;
+ this->RetryCount = "";
+ this->RetryDelay = "";
+ this->CDashUpload = false;
+ this->Arguments[cts_BUILD_ID] = "BUILD_ID";
+ this->Last = cts_LAST;
+}
+
+/**
+ * This is a virtual constructor for the command.
+ */
+cmCommand* cmCTestSubmitCommand::Clone()
+{
+ cmCTestSubmitCommand* ni = new cmCTestSubmitCommand;
+ ni->CTest = this->CTest;
+ ni->CTestScriptHandler = this->CTestScriptHandler;
+ return ni;
+}
+
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
{
const char* submitURL = !this->SubmitURL.empty()
@@ -111,7 +134,15 @@ bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
this->CDashUpload = !args.empty() && args[0] == "CDASH_UPLOAD";
- return this->cmCTestHandlerCommand::InitialPass(args, status);
+
+ bool ret = this->cmCTestHandlerCommand::InitialPass(args, status);
+
+ if (this->Values[cts_BUILD_ID] && *this->Values[cts_BUILD_ID]) {
+ this->Makefile->AddDefinition(this->Values[cts_BUILD_ID],
+ this->CTest->GetBuildID().c_str());
+ }
+
+ return ret;
}
bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index 4b1bb26..1e27046 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -25,26 +25,8 @@ class cmExecutionStatus;
class cmCTestSubmitCommand : public cmCTestHandlerCommand
{
public:
- cmCTestSubmitCommand()
- {
- this->PartsMentioned = false;
- this->FilesMentioned = false;
- this->InternalTest = false;
- this->RetryCount = "";
- this->RetryDelay = "";
- this->CDashUpload = false;
- }
-
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() override
- {
- cmCTestSubmitCommand* ni = new cmCTestSubmitCommand;
- ni->CTest = this->CTest;
- ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
- }
+ cmCTestSubmitCommand();
+ cmCommand* Clone() override;
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
@@ -75,6 +57,12 @@ protected:
ArgumentDoingLast2
};
+ enum
+ {
+ cts_BUILD_ID = ct_LAST,
+ cts_LAST
+ };
+
bool PartsMentioned;
std::set<cmCTest::Part> Parts;
bool FilesMentioned;
diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
index 4d7d29b..78856b4 100644
--- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
@@ -31,7 +31,7 @@ run_ctest_submit(CDashUploadNone CDASH_UPLOAD)
run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload)
run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM)
run_ctest_submit(CDashSubmitQuiet QUIET)
-run_ctest_submit_debug(CDashSubmitVerbose)
+run_ctest_submit_debug(CDashSubmitVerbose BUILD_ID my_build_id)
run_ctest_submit_debug(FILESNoBuildId FILES ${CMAKE_CURRENT_LIST_FILE})
run_ctest_submit_debug(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf")
run_ctest_submit_debug(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf")