summaryrefslogtreecommitdiffstats
path: root/Help/prop_test
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2021-07-02 13:54:38 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2021-07-09 12:45:18 (GMT)
commitde4f1f26b0a3217f7caf842c50857b1ac90d9b7d (patch)
tree655178cd8c11efe1ef3fff26acca0a351b69cc34 /Help/prop_test
parent4c757fa3c8a8d5bc32b8d169b2ebfb7781f3ea0c (diff)
downloadCMake-de4f1f26b0a3217f7caf842c50857b1ac90d9b7d.zip
CMake-de4f1f26b0a3217f7caf842c50857b1ac90d9b7d.tar.gz
CMake-de4f1f26b0a3217f7caf842c50857b1ac90d9b7d.tar.bz2
CTest: add an ENVIRONMENT_MODIFICATION property
This property allows projects to modify environment variables at test time rather than trying to guess what the state should be based on what is present at configure time. Of particular interest is the ability to use a `PATH` present at test time while adding entries known to be necessary for the test itself. There are multiple operations provided to modify variables, including: - setting and unsetting - appending and prepending as: - strings - path lists - CMake lists Additionally, a `reset` action is provided to cancel any prior modifications to that particular variable in the case of incremental additions to the test property.
Diffstat (limited to 'Help/prop_test')
-rw-r--r--Help/prop_test/ENVIRONMENT_MODIFICATION.rst33
1 files changed, 33 insertions, 0 deletions
diff --git a/Help/prop_test/ENVIRONMENT_MODIFICATION.rst b/Help/prop_test/ENVIRONMENT_MODIFICATION.rst
new file mode 100644
index 0000000..ffd5de4
--- /dev/null
+++ b/Help/prop_test/ENVIRONMENT_MODIFICATION.rst
@@ -0,0 +1,33 @@
+ENVIRONMENT_MODIFICATION
+------------------------
+
+Specify environment variables that should be modified for running a test. Note
+that the operations performed by this property are performed after the
+:prop_test:`ENVIRONMENT` property is already applied.
+
+If set to a list of environment variables and values of the form
+``MYVAR=OP:VALUE``. Entries are considered in the order specified in the
+property's value. The ``OP`` may be one of:
+
+ - ``reset``: Reset to the unmodified value, ignoring all modifications to
+ ``MYVAR`` prior to this entry. Note that this will reset the variable to
+ the value set by :prop_test:`ENVIRONMENT`, if it was set, and otherwise
+ to its state from the rest of the CTest execution.
+ - ``set``: Replaces the current value of ``MYVAR`` with ``VALUE``.
+ - ``unset``: Unsets the current value of ``MYVAR``.
+ - ``string_append``: Appends ``VALUE`` to the current value of ``MYVAR``.
+ - ``string_prepend``: Prepends ``VALUE`` to the current value of ``MYVAR``.
+ - ``path_list_append``: Appends ``VALUE`` to the current value of ``MYVAR``
+ using the platform-specific list separator.
+ - ``path_list_prepend``: Prepends ``VALUE`` to the current value of
+ ``MYVAR`` using the platform-specific list separator.
+ - ``cmake_list_append``: Appends ``VALUE`` to the current value of ``MYVAR``
+ using ``;`` as the separator.
+ - ``cmake_list_prepend``: Prepends ``VALUE`` to the current value of
+ ``MYVAR`` using ``;`` as the separator.
+
+Unrecognized ``OP`` values will result in the test failing before it is
+executed. This is so that future operations may be added without changing
+valid behavior of existing tests.
+
+The environment changes from this property do not affect other tests.