ctest: allow CTest Script variables to be set via the command-line

Allow CTEST_* variables to be defined on the command-line when using
`ctest -T`.

Fixes: #27788
This commit is contained in:
Zack Galbreath
2026-05-14 11:37:57 -04:00
parent 21b9c20592
commit 2e214f0a5b
62 changed files with 232 additions and 60 deletions
+20 -4
View File
@@ -848,15 +848,31 @@ Options for Dashboard Client include:
The available ``<dashboard-options>`` are the following:
.. option:: -D <var>:<type>=<value>
.. _`ctest-option-D-var`:
Define a variable for script mode.
.. option:: -D <var>:<type>=<value>, -D <var>=<value>
Pass in variable values on the command line. Use in conjunction
with :ctest-option:`-S` to pass variable values to a dashboard script.
Define a variable for dashboard client mode.
Pass in variable values on the command line. Use in conjunction with
:ctest-option:`-S` to pass variable values to a dashboard script, or with
:ctest-option:`-T` to override `Dashboard Client Configuration`_ settings.
Parsing ``-D`` arguments as variable values is only attempted if the value
following ``-D`` does not match any of the known dashboard types.
The ``<var>:<type>=<value>`` form accepts any variable name. The simpler
``<var>=<value>`` form (without a type) is accepted only for variables whose
names begin with ``CTEST_``. In both cases the value overrides the
corresponding setting from the `Dashboard Client Configuration`_ file
(e.g., ``DartConfiguration.tcl``) when using :ctest-option:`-T`.
.. note::
These definitions set CTest script variables
(e.g., :variable:`CTEST_BUILD_NAME`), not CMake cache variables.
To pass CMake cache variables to the configure step, consider using a
`CTest Script`_, a :manual:`configure preset <cmake-presets(7)>`, or
setting :variable:`CTEST_CONFIGURE_COMMAND`.
.. option:: --group <group>
Specify what group you'd like to submit results to
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_BINARY_DIRECTORY
.. versionadded:: 3.1
Specify the CTest ``BuildDirectory`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_BUILD_COMMAND
.. versionadded:: 3.1
Specify the CTest ``MakeCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_BUILD_NAME
.. versionadded:: 3.1
Specify the CTest ``BuildName`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_BZR_COMMAND
.. versionadded:: 3.1
Specify the CTest ``BZRCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_BZR_UPDATE_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``BZRUpdateOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,7 +4,8 @@ CTEST_CHANGE_ID
.. versionadded:: 3.4
Specify the CTest ``ChangeId`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
This setting allows CTest to pass arbitrary information about this
build up to CDash. One use of this feature is to allow CDash to
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_CHECKOUT_COMMAND
.. versionadded:: 3.1
Tell the :command:`ctest_start` command how to checkout or initialize
the source directory in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
the source directory in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_CONFIGURE_COMMAND
.. versionadded:: 3.1
Specify the CTest ``ConfigureCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,7 +4,8 @@ CTEST_COVERAGE_COMMAND
.. versionadded:: 3.1
Specify the CTest ``CoverageCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
Cobertura
'''''''''
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_COVERAGE_EXTRA_FLAGS
.. versionadded:: 3.1
Specify the CTest ``CoverageExtraFlags`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -8,4 +8,5 @@ CTEST_CURL_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``CurlOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_CVS_COMMAND
.. versionadded:: 3.1
Specify the CTest ``CVSCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_CVS_UPDATE_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``CVSUpdateOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_DROP_LOCATION
.. versionadded:: 3.1
Specify the CTest ``DropLocation`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_DROP_METHOD
.. versionadded:: 3.1
Specify the CTest ``DropMethod`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_DROP_SITE
.. versionadded:: 3.1
Specify the CTest ``DropSite`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_DROP_SITE_PASSWORD
.. versionadded:: 3.1
Specify the CTest ``DropSitePassword`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_DROP_SITE_USER
.. versionadded:: 3.1
Specify the CTest ``DropSiteUser`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -2,4 +2,5 @@ CTEST_EXTRA_SUBMIT_FILES
------------------------
Specify files for :command:`ctest_submit(PARTS ExtraFiles)` to submit
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_GIT_COMMAND
.. versionadded:: 3.1
Specify the CTest ``GITCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_GIT_INIT_SUBMODULES
.. versionadded:: 3.6
Specify the CTest ``GITInitSubmodules`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_GIT_UPDATE_CUSTOM
.. versionadded:: 3.1
Specify the CTest ``GITUpdateCustom`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_GIT_UPDATE_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``GITUpdateOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_HG_COMMAND
.. versionadded:: 3.1
Specify the CTest ``HGCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_HG_UPDATE_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``HGUpdateOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
@@ -4,4 +4,5 @@ CTEST_LABELS_FOR_SUBPROJECTS
.. versionadded:: 3.10
Specify the CTest ``LabelsForSubprojects`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_MEMORYCHECK_COMMAND
.. versionadded:: 3.1
Specify the CTest ``MemoryCheckCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
@@ -4,4 +4,5 @@ CTEST_MEMORYCHECK_COMMAND_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``MemoryCheckCommandOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
@@ -4,7 +4,8 @@ CTEST_MEMORYCHECK_SANITIZER_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``MemoryCheckSanitizerOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
CTest prepends correct sanitizer options ``*_OPTIONS``
environment variable to executed command. CTests adds
@@ -4,4 +4,5 @@ CTEST_MEMORYCHECK_SUPPRESSIONS_FILE
.. versionadded:: 3.1
Specify the CTest ``MemoryCheckSuppressionFile`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,7 +4,8 @@ CTEST_MEMORYCHECK_TYPE
.. versionadded:: 3.1
Specify the CTest ``MemoryCheckType`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
Valid values are ``Valgrind``, ``Purify``, ``BoundsChecker``, ``DrMemory``,
``CudaSanitizer``, ``ThreadSanitizer``, ``AddressSanitizer``, ``LeakSanitizer``,
``MemorySanitizer`` and ``UndefinedBehaviorSanitizer``.
+2 -1
View File
@@ -4,7 +4,8 @@ CTEST_NIGHTLY_START_TIME
.. versionadded:: 3.1
Specify the CTest ``NightlyStartTime`` setting in a :manual:`ctest(1)`
:ref:`Dashboard Client` script.
:ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
Note that this variable must always be set for a nightly build in a
dashboard script. It is needed so that nightly builds can be properly grouped
+2 -1
View File
@@ -2,4 +2,5 @@ CTEST_NOTES_FILES
-----------------
Specify files for :command:`ctest_submit(PARTS Notes)` to submit
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_P4_CLIENT
.. versionadded:: 3.1
Specify the CTest ``P4Client`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_P4_COMMAND
.. versionadded:: 3.1
Specify the CTest ``P4Command`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_P4_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``P4Options`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_P4_UPDATE_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``P4UpdateOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,7 +4,8 @@ CTEST_RESOURCE_SPEC_FILE
.. versionadded:: 3.18
Specify the CTest ``ResourceSpecFile`` setting in a :manual:`ctest(1)`
:ref:`Dashboard Client` script.
:ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
This can also be used to specify the resource spec file from a CMake build. If
no ``RESOURCE_SPEC_FILE`` is passed to :command:`ctest_test`, and
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_SITE
.. versionadded:: 3.1
Specify the CTest ``Site`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_SOURCE_DIRECTORY
.. versionadded:: 3.1
Specify the CTest ``SourceDirectory`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
@@ -4,4 +4,5 @@ CTEST_SUBMIT_INACTIVITY_TIMEOUT
.. versionadded:: 3.23
Specify the CTest ``SubmitInactivityTimeout`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_SUBMIT_URL
.. versionadded:: 3.14
Specify the CTest ``SubmitURL`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_SVN_COMMAND
.. versionadded:: 3.1
Specify the CTest ``SVNCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_SVN_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``SVNOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_SVN_UPDATE_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``SVNUpdateOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_TEST_COVERAGE_TOOL
.. versionadded:: 4.4
Specify the CTest :ref:`CoverageTool <ctest-CoverageTool>` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,6 +4,7 @@ CTEST_TEST_LOAD
.. versionadded:: 3.4
Specify the ``TestLoad`` setting in the :ref:`CTest Test Step`
of a :manual:`ctest(1)` :ref:`Dashboard Client` script. This sets the
of a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option. This sets the
default value for the ``TEST_LOAD`` option of the :command:`ctest_test`
command.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_TEST_TIMEOUT
.. versionadded:: 3.1
Specify the CTest ``TimeOut`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -5,7 +5,8 @@ CTEST_TLS_VERIFY
Specify the CTest ``TLSVerify`` setting in a :manual:`ctest(1)`
:ref:`Dashboard Client` script or in project ``CMakeLists.txt`` code
before including the :module:`CTest` module. The value is a boolean
before including the :module:`CTest` module, or on the :program:`ctest`
command line via the :ref:`-D <ctest-option-D-var>` option. The value is a boolean
indicating whether to verify the server certificate when submitting
to a dashboard via ``https://`` URLs.
+2 -1
View File
@@ -5,7 +5,8 @@ CTEST_TLS_VERSION
Specify the CTest ``TLSVersion`` setting in a :manual:`ctest(1)`
:ref:`Dashboard Client` script or in project ``CMakeLists.txt`` code
before including the :module:`CTest` module. The value is a minimum
before including the :module:`CTest` module, or on the :program:`ctest`
command line via the :ref:`-D <ctest-option-D-var>` option. The value is a minimum
TLS version allowed when submitting to a dashboard via ``https://`` URLs.
The value may be one of:
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_UPDATE_COMMAND
.. versionadded:: 3.1
Specify the CTest ``UpdateCommand`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_UPDATE_OPTIONS
.. versionadded:: 3.1
Specify the CTest ``UpdateOptions`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_UPDATE_VERSION_ONLY
.. versionadded:: 3.1
Specify the CTest :ref:`UpdateVersionOnly <UpdateVersionOnly>` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
@@ -4,4 +4,5 @@ CTEST_UPDATE_VERSION_OVERRIDE
.. versionadded:: 3.15
Specify the CTest :ref:`UpdateVersionOverride <UpdateVersionOverride>` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+2 -1
View File
@@ -4,4 +4,5 @@ CTEST_USE_LAUNCHERS
.. versionadded:: 3.1
Specify the CTest ``UseLaunchers`` setting
in a :manual:`ctest(1)` :ref:`Dashboard Client` script.
in a :manual:`ctest(1)` :ref:`Dashboard Client` script,
or on the :program:`ctest` command line via the :ref:`-D <ctest-option-D-var>` option.
+52 -1
View File
@@ -539,6 +539,7 @@ bool cmCTest::UpdateCTestConfiguration()
// No need to exit if we are not producing XML
if (this->Impl->ProduceXML) {
cmCTestLog(this, WARNING, "Cannot find file: " << fileName << std::endl);
this->ApplyDefinitionsToCTestConfig();
return false;
}
} else {
@@ -602,6 +603,8 @@ bool cmCTest::UpdateCTestConfiguration()
this->Impl->CompressXMLFiles =
cmIsOn(this->GetCTestConfiguration("CompressSubmission"));
}
// Command-line definitions override values loaded from the config file.
this->ApplyDefinitionsToCTestConfig();
return true;
}
@@ -1466,7 +1469,9 @@ void cmCTest::ErrorMessageUnknownDashDValue(std::string const& val)
" ctest -D Nightly\n"
" ctest -D Nightly(Start|Update|Configure|Build)\n"
" ctest -D Nightly(Test|Coverage|MemCheck|Submit)\n"
" ctest -D NightlyMemoryCheck\n");
" ctest -D NightlyMemoryCheck\n"
" ctest -D CTEST_<VAR>=<value>\n"
" ctest -D <var>:<type>=<value>\n");
}
bool cmCTest::CheckArgument(std::string const& arg, cm::string_view varg1,
@@ -1505,6 +1510,16 @@ bool cmCTest::AddVariableDefinition(std::string const& arg)
return true;
}
// Also accept CTEST_VAR=VALUE (without :TYPE=).
auto const eq = arg.find('=');
if (eq != std::string::npos && eq > 0) {
name = arg.substr(0, eq);
if (cmHasLiteralPrefix(name, "CTEST_")) {
this->Impl->Definitions[name] = arg.substr(eq + 1);
return true;
}
}
return false;
}
@@ -3232,6 +3247,20 @@ CTestVarConfigEntry const kCTestVarConfigMap[] = {
{ "CTEST_TIME_LIMIT", "TimeLimit" },
};
// clang-format on
// Entries accepted by ApplyDefinitionsToCTestConfig() (i.e. settable via
// "ctest -D") but not emitted by SetCMakeVariables(), because their forward
// direction is handled outside of that function.
//
// CTEST_CVS_CHECKOUT - Deprecated alias for CTEST_CHECKOUT_COMMAND.
// The canonical name is already in kCTestVarConfigMap.
// CTEST_CHANGE_ID - Handler commands push this *into* the config map
// themselves rather than reading it out;
// SetCMakeVariables intentionally has no entry for it.
CTestVarConfigEntry const kCTestVarConfigMapReverseOnly[] = {
{ "CTEST_CVS_CHECKOUT", "CheckoutCommand" },
{ "CTEST_CHANGE_ID", "ChangeId" },
};
} // namespace
void cmCTest::SetCMakeVariables(cmMakefile& mf)
@@ -3247,6 +3276,28 @@ void cmCTest::SetCMakeVariables(cmMakefile& mf)
}
}
void cmCTest::ApplyDefinitionsToCTestConfig()
{
// Build a reverse-lookup map from both tables the first time this is called.
static std::map<std::string, std::string> const reverseMap = []() {
std::map<std::string, std::string> m;
for (auto const& e : kCTestVarConfigMap) {
m.emplace(e.Var, e.Config);
}
for (auto const& e : kCTestVarConfigMapReverseOnly) {
m.emplace(e.Var, e.Config);
}
return m;
}();
for (auto const& def : this->Impl->Definitions) {
auto const it = reverseMap.find(def.first);
if (it != reverseMap.end()) {
this->SetCTestConfiguration(it->second.c_str(), def.second);
}
}
}
bool cmCTest::RunCommand(std::vector<std::string> const& args,
std::string* stdOut, std::string* stdErr, int* retVal,
char const* dir, cmDuration timeout,
+3
View File
@@ -452,6 +452,9 @@ private:
/** add a variable definition from a command line -D value */
bool AddVariableDefinition(std::string const& arg);
/** apply CTEST_* variable definitions to the CTest configuration map */
void ApplyDefinitionsToCTestConfig();
/** set command line arguments read from a test preset */
bool SetArgsFromPreset(cmCMakePresetsArgs const& args);
@@ -0,0 +1 @@
.*Build name: cli-build-name.*
@@ -0,0 +1,7 @@
.*CTEST_BUILD_NAME=cli-build-name.*
.*CTEST_SITE=cli-site.*
.*CTEST_BUILD_FLAGS=-O2 -Wall.*
.*CTEST_BUILD_TARGET=my-target.*
.*CTEST_CMAKE_GENERATOR=Ninja.*
.*CTEST_EXTRA_COVERAGE_GLOB=\*\*/\*.gcov.*
.*CTEST_TIME_LIMIT=3600.*
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.10)
# Verify that CTEST_* variables defined via -D on the ctest command line
# are available in the script.
message("CTEST_BUILD_NAME=${CTEST_BUILD_NAME}")
message("CTEST_SITE=${CTEST_SITE}")
message("CTEST_BUILD_FLAGS=${CTEST_BUILD_FLAGS}")
message("CTEST_BUILD_TARGET=${CTEST_BUILD_TARGET}")
message("CTEST_CMAKE_GENERATOR=${CTEST_CMAKE_GENERATOR}")
message("CTEST_EXTRA_COVERAGE_GLOB=${CTEST_EXTRA_COVERAGE_GLOB}")
message("CTEST_TIME_LIMIT=${CTEST_TIME_LIMIT}")
@@ -785,3 +785,32 @@ add_test(test1 \"${CMAKE_COMMAND}\" -E true)
run_cmake_command(CoverageTool ${CMAKE_CTEST_COMMAND} -V)
run_cmake_command(CoverageTool-T-Test ${CMAKE_CTEST_COMMAND} -V -T Test)
endblock()
# Verify that CTEST_* variables defined via the command-line are visible
# from the CTest script.
run_cmake_command(DashD-ScriptVars
${CMAKE_CTEST_COMMAND}
"-S" "${RunCMake_SOURCE_DIR}/DashD-ScriptVars.cmake"
"-D" "CTEST_BUILD_NAME=cli-build-name"
"-D" "CTEST_SITE=cli-site"
"-D" "CTEST_BUILD_FLAGS=-O2 -Wall"
"-D" "CTEST_BUILD_TARGET=my-target"
"-D" "CTEST_CMAKE_GENERATOR=Ninja"
"-D" "CTEST_EXTRA_COVERAGE_GLOB=**/*.gcov"
"-D" "CTEST_TIME_LIMIT=3600"
)
# Verify that CTEST_* variables defined via the command-line override
# settings from the dashboard configuration file.
block()
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DashD-DashboardVar-build)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
file(WRITE "${RunCMake_TEST_BINARY_DIR}/DartConfiguration.tcl"
"BuildName: original-build-name\nSite: original-site\nSourceDirectory: ${RunCMake_TEST_BINARY_DIR}\n")
run_cmake_command(DashD-DashboardVar
${CMAKE_CTEST_COMMAND} -M Experimental -T Start
-D CTEST_BUILD_NAME=cli-build-name
)
endblock()