File: TIMEOUT_AFTER_MATCH.rst

package info (click to toggle)
cmake 3.31.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 142,992 kB
  • sloc: ansic: 393,437; cpp: 288,767; sh: 3,958; yacc: 3,240; python: 3,015; lex: 1,337; asm: 438; f90: 429; lisp: 375; cs: 270; java: 266; perl: 217; objc: 212; xml: 198; fortran: 137; makefile: 96; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (43 lines) | stat: -rw-r--r-- 1,462 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
TIMEOUT_AFTER_MATCH
-------------------

.. versionadded:: 3.6

Change a test's timeout duration after a matching line is encountered
in its output.

Usage
^^^^^

.. code-block:: cmake

 add_test(mytest ...)
 set_property(TEST mytest PROPERTY TIMEOUT_AFTER_MATCH "${seconds}" "${regex}")

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`.