summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2023-11-11 16:33:39 (GMT)
committerBrad King <brad.king@kitware.com>2023-12-13 15:20:43 (GMT)
commit1ec0372ed4b450e242fdb8f6a7d2862baa61b501 (patch)
tree2ae040a6f48ea682b62f72b56b593b72f3f286c5 /Help
parent478a5f4e044d253971e71a41ad6fc6b8aa4e1c07 (diff)
downloadCMake-1ec0372ed4b450e242fdb8f6a7d2862baa61b501.zip
CMake-1ec0372ed4b450e242fdb8f6a7d2862baa61b501.tar.gz
CMake-1ec0372ed4b450e242fdb8f6a7d2862baa61b501.tar.bz2
add_test: Optionally use a launcher for tests running in-project targets
Add a `CMAKE_TEST_LAUNCHER` variable and corresponding `TEST_LAUNCHER` target property. Issue: #23672
Diffstat (limited to 'Help')
-rw-r--r--Help/command/add_test.rst28
-rw-r--r--Help/envvar/CMAKE_TEST_LAUNCHER.rst11
-rw-r--r--Help/manual/cmake-env-variables.7.rst1
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/prop_test/PASS_REGULAR_EXPRESSION.rst3
-rw-r--r--Help/prop_test/SKIP_REGULAR_EXPRESSION.rst3
-rw-r--r--Help/prop_test/SKIP_RETURN_CODE.rst3
-rw-r--r--Help/prop_test/WILL_FAIL.rst3
-rw-r--r--Help/prop_tgt/TEST_LAUNCHER.rst20
-rw-r--r--Help/release/dev/cmake-test-launcher.rst7
-rw-r--r--Help/variable/CMAKE_TEST_LAUNCHER.rst16
12 files changed, 90 insertions, 7 deletions
diff --git a/Help/command/add_test.rst b/Help/command/add_test.rst
index 02dd3986..37b9563 100644
--- a/Help/command/add_test.rst
+++ b/Help/command/add_test.rst
@@ -27,9 +27,31 @@ directory the test is created in.
``add_test`` options are:
``COMMAND``
- Specify the test command-line. If ``<command>`` specifies an executable
- target created by :command:`add_executable`, it will automatically be
- replaced by the location of the executable created at build time.
+ Specify the test command-line.
+
+ If ``<command>`` specifies an executable target created by
+ :command:`add_executable`:
+
+ * It will automatically be replaced by the location of the executable
+ created at build time.
+
+ * .. versionadded:: 3.3
+
+ The target's :prop_tgt:`CROSSCOMPILING_EMULATOR`, if set, will be
+ used to run the command on the host::
+
+ <emulator> <command>
+
+ * .. versionadded:: 3.29
+
+ The target's :prop_tgt:`TEST_LAUNCHER`, if set, will be
+ used to launch the command::
+
+ <launcher> <command>
+
+ If the :prop_tgt:`CROSSCOMPILING_EMULATOR` is also set, both are used::
+
+ <launcher> <emulator> <command>
The command may be specified using
:manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/envvar/CMAKE_TEST_LAUNCHER.rst b/Help/envvar/CMAKE_TEST_LAUNCHER.rst
new file mode 100644
index 0000000..d620ce5
--- /dev/null
+++ b/Help/envvar/CMAKE_TEST_LAUNCHER.rst
@@ -0,0 +1,11 @@
+CMAKE_TEST_LAUNCHER
+-------------------
+
+.. versionadded:: 3.29
+
+.. include:: ENV_VAR.txt
+
+The default value for the :variable:`CMAKE_TEST_LAUNCHER` variable when there
+is no explicit configuration given on the first run while creating a new
+build tree. On later runs in an existing build tree the value persists in
+the cache as :variable:`CMAKE_TEST_LAUNCHER`.
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index 55f07b7..5272ab9 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -56,6 +56,7 @@ Environment Variables that Control the Build
/envvar/CMAKE_MSVCIDE_RUN_PATH
/envvar/CMAKE_NO_VERBOSE
/envvar/CMAKE_OSX_ARCHITECTURES
+ /envvar/CMAKE_TEST_LAUNCHER
/envvar/CMAKE_TOOLCHAIN_FILE
/envvar/DESTDIR
/envvar/LDFLAGS
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index b0f3db0..458cb73 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -398,6 +398,7 @@ Properties on Targets
/prop_tgt/Swift_MODULE_DIRECTORY
/prop_tgt/Swift_MODULE_NAME
/prop_tgt/SYSTEM
+ /prop_tgt/TEST_LAUNCHER
/prop_tgt/TYPE
/prop_tgt/UNITY_BUILD
/prop_tgt/UNITY_BUILD_BATCH_SIZE
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 80acd90..0e778f8 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -117,6 +117,7 @@ Variables that Provide Information
/variable/CMAKE_Swift_COMPILATION_MODE
/variable/CMAKE_Swift_MODULE_DIRECTORY
/variable/CMAKE_Swift_NUM_THREADS
+ /variable/CMAKE_TEST_LAUNCHER
/variable/CMAKE_TOOLCHAIN_FILE
/variable/CMAKE_TWEAK_VERSION
/variable/CMAKE_VERBOSE_MAKEFILE
diff --git a/Help/prop_test/PASS_REGULAR_EXPRESSION.rst b/Help/prop_test/PASS_REGULAR_EXPRESSION.rst
index 9f92491..b19e637 100644
--- a/Help/prop_test/PASS_REGULAR_EXPRESSION.rst
+++ b/Help/prop_test/PASS_REGULAR_EXPRESSION.rst
@@ -23,7 +23,8 @@ Example:
To run a test that may have a system-level failure, but still pass if
``PASS_REGULAR_EXPRESSION`` matches, use a CMake command to wrap the
executable run. Note that this will prevent automatic handling of the
-:prop_tgt:`CROSSCOMPILING_EMULATOR` target property.
+:prop_tgt:`CROSSCOMPILING_EMULATOR` and :prop_tgt:`TEST_LAUNCHER`
+target property.
.. code-block:: cmake
diff --git a/Help/prop_test/SKIP_REGULAR_EXPRESSION.rst b/Help/prop_test/SKIP_REGULAR_EXPRESSION.rst
index 9836412..8717a0a 100644
--- a/Help/prop_test/SKIP_REGULAR_EXPRESSION.rst
+++ b/Help/prop_test/SKIP_REGULAR_EXPRESSION.rst
@@ -25,7 +25,8 @@ Example:
To run a test that may have a system-level failure, but still skip if
``SKIP_REGULAR_EXPRESSION`` matches, use a CMake command to wrap the
executable run. Note that this will prevent automatic handling of the
-:prop_tgt:`CROSSCOMPILING_EMULATOR` target property.
+:prop_tgt:`CROSSCOMPILING_EMULATOR` and :prop_tgt:`TEST_LAUNCHER`
+target property.
.. code-block:: cmake
diff --git a/Help/prop_test/SKIP_RETURN_CODE.rst b/Help/prop_test/SKIP_RETURN_CODE.rst
index 096eb09..57fc031 100644
--- a/Help/prop_test/SKIP_RETURN_CODE.rst
+++ b/Help/prop_test/SKIP_RETURN_CODE.rst
@@ -25,7 +25,8 @@ signal abort, or heap errors may fail the test even if the return code matches.
To run a test that may have a system-level failure, but still skip if
``SKIP_RETURN_CODE`` matches, use a CMake command to wrap the executable run.
Note that this will prevent automatic handling of the
-:prop_tgt:`CROSSCOMPILING_EMULATOR` target property.
+:prop_tgt:`CROSSCOMPILING_EMULATOR` and :prop_tgt:`TEST_LAUNCHER` target
+property.
.. code-block:: cmake
diff --git a/Help/prop_test/WILL_FAIL.rst b/Help/prop_test/WILL_FAIL.rst
index 53437d2..9d61ab7 100644
--- a/Help/prop_test/WILL_FAIL.rst
+++ b/Help/prop_test/WILL_FAIL.rst
@@ -19,7 +19,8 @@ is ``true``:
To run a test that may have a system-level failure, but still pass if
``WILL_FAIL`` is set, use a CMake command to wrap the executable run.
Note that this will prevent automatic handling of the
-:prop_tgt:`CROSSCOMPILING_EMULATOR` target property.
+:prop_tgt:`CROSSCOMPILING_EMULATOR` and :prop_tgt:`TEST_LAUNCHER`
+target property.
.. code-block:: cmake
diff --git a/Help/prop_tgt/TEST_LAUNCHER.rst b/Help/prop_tgt/TEST_LAUNCHER.rst
new file mode 100644
index 0000000..2e44492
--- /dev/null
+++ b/Help/prop_tgt/TEST_LAUNCHER.rst
@@ -0,0 +1,20 @@
+TEST_LAUNCHER
+-------------
+
+.. versionadded:: 3.29
+
+Use the given launcher to run executables.
+This command will be added as a prefix to :command:`add_test` commands
+for build target system executables and is meant to be run on the host
+machine.
+
+It effectively acts as a run script for tests in a similar way
+to how :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` works for compilation.
+
+If this property contains a :ref:`semicolon-separated list <CMake Language
+Lists>`, then the first value is the command and remaining values are its
+arguments.
+
+This property is initialized by the value of the
+:variable:`CMAKE_TEST_LAUNCHER` variable if it is set when a target
+is created.
diff --git a/Help/release/dev/cmake-test-launcher.rst b/Help/release/dev/cmake-test-launcher.rst
new file mode 100644
index 0000000..e97498d
--- /dev/null
+++ b/Help/release/dev/cmake-test-launcher.rst
@@ -0,0 +1,7 @@
+cmake-test-launcher
+-------------------
+
+* A :variable:`CMAKE_TEST_LAUNCHER` variable and corresponding
+ :prop_tgt:`TEST_LAUNCHER` target property were added to specify
+ a launcher to be used by executable targets when invoked by
+ tests added by the :command:`add_test` command.
diff --git a/Help/variable/CMAKE_TEST_LAUNCHER.rst b/Help/variable/CMAKE_TEST_LAUNCHER.rst
new file mode 100644
index 0000000..c527188
--- /dev/null
+++ b/Help/variable/CMAKE_TEST_LAUNCHER.rst
@@ -0,0 +1,16 @@
+CMAKE_TEST_LAUNCHER
+-------------------
+
+.. versionadded:: 3.29
+
+This variable is used to specify a launcher for running tests, added
+by the :command:`add_test` command, that run an executable target.
+If this variable contains a :ref:`semicolon-separated list <CMake Language
+Lists>`, then the first value is the command and remaining values are its
+arguments.
+
+This variable can be initialized via an
+:envvar:`CMAKE_TEST_LAUNCHER` environment variable.
+
+It is also used as the default value for the
+:prop_tgt:`TEST_LAUNCHER` target property of executables.