• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1TIMEOUT_AFTER_MATCH
2-------------------
3
4.. versionadded:: 3.6
5
6Change a test's timeout duration after a matching line is encountered
7in its output.
8
9Usage
10^^^^^
11
12.. code-block:: cmake
13
14 add_test(mytest ...)
15 set_property(TEST mytest PROPERTY TIMEOUT_AFTER_MATCH "${seconds}" "${regex}")
16
17Description
18^^^^^^^^^^^
19
20Allow a test ``seconds`` to complete after ``regex`` is encountered in
21its output.
22
23When the test outputs a line that matches ``regex`` its start time is
24reset to the current time and its timeout duration is changed to
25``seconds``.  Prior to this, the timeout duration is determined by the
26:prop_test:`TIMEOUT` property or the :variable:`CTEST_TEST_TIMEOUT`
27variable if either of these are set.  Because the test's start time is
28reset, its execution time will not include any time that was spent
29waiting for the matching output.
30
31:prop_test:`TIMEOUT_AFTER_MATCH` is useful for avoiding spurious
32timeouts when your test must wait for some system resource to become
33available before it can execute.  Set :prop_test:`TIMEOUT` to a longer
34duration that accounts for resource acquisition and use
35:prop_test:`TIMEOUT_AFTER_MATCH` to control how long the actual test
36is allowed to run.
37
38If the required resource can be controlled by CTest you should use
39:prop_test:`RESOURCE_LOCK` instead of :prop_test:`TIMEOUT_AFTER_MATCH`.
40This property should be used when only the test itself can determine
41when its required resources are available.
42