TIMEOUT_AFTER_MATCH.rst 1.4 KB

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