text
stringlengths
0
88
Description
^^^^^^^^^^^
Allow a test ``seconds`` to complete after ``regex`` is encountered in
its output.
When the test outputs a line that matches ``regex`` its start time is
reset to the current time and its timeout duration is changed to
``seconds``. Prior to this, the timeout duration is determined by the
:prop_test:`TIMEOUT` property or the :variable:`CTEST_TEST_TIMEOUT`
variable if either of these are set. Because the test's start time is
reset, its execution time will not include any time that was spent
waiting for the matching output.
``TIMEOUT_AFTER_MATCH`` is useful for avoiding spurious
timeouts when your test must wait for some system resource to become
available before it can execute. Set :prop_test:`TIMEOUT` to a longer
duration that accounts for resource acquisition and use
``TIMEOUT_AFTER_MATCH`` to control how long the actual test
is allowed to run.
If the required resource can be controlled by CTest you should use
:prop_test:`RESOURCE_LOCK` instead of ``TIMEOUT_AFTER_MATCH``.
This property should be used when only the test itself can determine
when its required resources are available.
See also :prop_test:`TIMEOUT_SIGNAL_NAME`.
TIMEOUT_SIGNAL_GRACE_PERIOD
---------------------------
.. versionadded:: 3.27
If the :prop_test:`TIMEOUT_SIGNAL_NAME` test property is set, this property
specifies the number of seconds to wait for a test process to terminate after
sending the custom signal. Otherwise, this property has no meaning.
The grace period may be any real value greater than ``0.0``, but not greater
than ``60.0``. If this property is not set, the default is ``1.0`` second.
This is available only on platforms supporting POSIX signals.
It is not available on Windows.
TIMEOUT_SIGNAL_NAME
-------------------
.. versionadded:: 3.27
Specify a custom signal to send to a test process when its timeout is reached.
This is available only on platforms supporting POSIX signals.
It is not available on Windows.
The name must be one of the following:
``SIGINT``
Interrupt.
``SIGQUIT``
Quit.
``SIGTERM``
Terminate.
``SIGUSR1``
User defined signal 1.
``SIGUSR2``
User defined signal 2.
The custom signal is sent to the test process to give it a chance
to exit gracefully during a grace period:
* If the test process created any children, it is responsible for
terminating them too.
* The grace period length is determined by the
:prop_test:`TIMEOUT_SIGNAL_GRACE_PERIOD` test property.
* If the test process does not terminate before the grace period ends,
:manual:`ctest(1)` will force termination of its entire process tree
via ``SIGSTOP`` and ``SIGKILL``.
See also :variable:`CTEST_TEST_TIMEOUT`,
:prop_test:`TIMEOUT`, and :prop_test:`TIMEOUT_AFTER_MATCH`.
WILL_FAIL
---------
If set to true, this will invert the pass/fail flag of the test.
This property can be used for tests that are expected to fail and return a
non-zero return code. Note that system-level test failures such as segmentation
faults or heap errors will still fail the test even if ``WILL_FALL`` is true.
WORKING_DIRECTORY
-----------------
The directory from which the test executable will be called.
If this is not set, the test will be run with the working directory set to the
binary directory associated with where the test was created (i.e. the
:variable:`CMAKE_CURRENT_BINARY_DIR` for where :command:`add_test` was
called).