Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / test / doc / testing_tools / timeout.qbk
1 [/
2  / Copyright (c) 2015 Raffi Enficiaud
3  /
4  / Distributed under the Boost Software License, Version 1.0. (See accompanying
5  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  /]
7
8
9 [section:timeout Time-out for test cases]
10
11 The __UTF__ provides the decorator __decorator_timeout__ that specifies a time-out for a specific *test unit*.
12 The argument time is always expressed in *seconds ans wall-clock* time.
13
14 For test-cases, the time-out value sets the maximum allowed duration for the test. If this time is
15 exceeded, the test case is reported as failed. On some systems, the __UTF__ is able to force the test-case
16 to stop through a `SIGALRM` signal (see below).
17
18 For test-suites, the time-out value sets the maximum allowed duration for the entire suite to complete. This duration
19 is the accumulated time of all the test-cases contained in the sub-tree rooted on the test-suite, plus some extra
20 execution time needed by the __UTF__. For each test-units under a test-suite with time-out, the maximum allowed duration
21 is set as being the test-suite time out minus the accumulated execution time before the execution of the test-unit.
22 If this test-unit is a test-case, it is equivalent to setting the decorator __decorator_timeout__ to the test-case
23 with a time-out value expressed as before.
24
25 In case the test-suite times out, the
26 suite is flagged as `timed-out` and `failed`, and all the test units (suites and cases) that have not been executed
27 up to the time-out point are all skipped.
28
29 [bt_example decorator_11..decorator timeout..run-fail]
30
31 [note The macro
32   `BOOST_SIGACTION_BASED_SIGNAL_HANDLING` is defined
33   if Boost.Test is able to force the test-case to stop. This feature is for instance not supported on Windows.
34   The __UTF__ will still be able to report the test-case as failed (once the test-case finishes).]
35
36 [note The support of test suite level time-out has been added in [link ref_CHANGE_LOG_3_10 Boost 1.70 / __UTF__ v3.10] ]
37
38 [endsect]