TIMEOUT_AFTER_MATCH.rst 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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.
  19. :prop_test:`TIMEOUT_AFTER_MATCH` is useful for avoiding spurious
  20. timeouts when your test must wait for some system resource to become
  21. available before it can execute. Set :prop_test:`TIMEOUT` to a longer
  22. duration that accounts for resource acquisition and use
  23. :prop_test:`TIMEOUT_AFTER_MATCH` to control how long the actual test
  24. is allowed to run.
  25. If the required resource can be controlled by CTest you should use
  26. :prop_test:`RESOURCE_LOCK` instead of :prop_test:`TIMEOUT_AFTER_MATCH`.
  27. This property should be used when only the test itself can determine
  28. when its required resources are available.