@@ -2398,7 +2398,10 @@ simply by setting right '$TST_NEEDS_FOO'.
| 'TST_TIMEOUT' | Maximum timeout set for the test in sec. Must be int >= 1,
or -1 (special value to disable timeout), default is 300.
Variable is meant be set in tests, not by user.
- It's equivalent of `tst_test.timeout` in C.
+ It's equivalent of `tst_test.timeout` in C, but (unlike
+ the C API) it can be set also in the setup function.
+ This is useful if test length depends on input decided
+ during setup.
|=============================================================================
NOTE: Network tests (see testcases/network/README.md) use additional variables
@@ -552,8 +552,6 @@ tst_run()
tst_brk TCONF "test requires kernel $TST_MIN_KVER+"
fi
- _tst_setup_timer
-
[ "$TST_NEEDS_DEVICE" = 1 ] && TST_NEEDS_TMPDIR=1
if [ "$TST_NEEDS_TMPDIR" = 1 ]; then
@@ -594,6 +592,8 @@ tst_run()
fi
fi
+ _tst_setup_timer
+
#TODO check that test reports some results for each test function call
while [ $TST_ITERATIONS -gt 0 ]; do
if [ -n "$TST_TEST_DATA" ]; then
Postpone starting timer a bit after the execution allow to setup timer in test setup. This is useful if test length depends on input decided during setup. Signed-off-by: Petr Vorel <pvorel@suse.cz> --- New in v2. Hi, I'm ok, if you consider this risky. Next commit can be then changed to have TST_TIMEOUT=-1. Kind regards, Petr doc/test-writing-guidelines.txt | 5 ++++- testcases/lib/tst_test.sh | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-)