tst_test.sh: Run cleanup also on timeout
RFC PATCH 1/1 tst_test.sh: Run cleanup also on timeout
Also timeout requires to run a test cleanup (e.g. zram01.sh). Thus send first SIGINT, but keep also SIGKILL for safety reasons (after 5 sec to give cleanup function some time.
---
Example of output on timeout:
zram01 6 TINFO: filling zram0 (it can take long time)
zram01 1 TBROK: test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1 zram01 6 TBROK: test interrupted or timeout
zram01 6 TINFO: AppArmor enabled, this may affect test results
...
Kind regards,
Petr
testcases/lib/tst_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/lib/tst_test.sh +2 -2
@@ -21,7 +21,7 @@ export TST_LIB_LOADED=1 . tst_security.sh # default trap function -trap "tst_brk TBROK 'test interrupted'" INT +trap "tst_brk TBROK 'test interrupted or timeout'" INT _tst_do_exit() {
@@ -459,7 +459,7 @@ _tst_setup_timer() tst_res TINFO "timeout per run is ${h}h ${m}m ${s}s" - sleep $sec && tst_res TBROK "test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && kill -9 -$pid & + sleep $sec && tst_res TBROK "test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && { kill -2 -$pid; sleep 5; kill -9 -$pid; } & _tst_setup_timer_pid=$! }
Signature · 1 line
2.30.0
RFC PATCH 1/1 tst_test.sh: Run cleanup also on timeout
Hi,
Quoted 3 lines · Petr Vorel
Also timeout requires to run a test cleanup (e.g.
zram01.sh). Thus send first SIGINT, but keep also SIGKILL for safety reasons (after 5 sec to give cleanup function some time.
+1
testcases/lib/tst_test.sh export TST_LIB_LOADED=1 · line 24
Quoted 10 lines
testcases/lib/tst_test.sh +1
-1@@ -21,7 +21,7 @@ export TST_LIB_LOADED=1 . tst_security.sh # default trap function -trap "tst_brk TBROK 'test interrupted'" INT +trap "tst_brk TBROK 'test interrupted or timeout'" INT
should be "timed out" for consistency
testcases/lib/tst_test.sh _tst_setup_timer() · line 462
Quoted 9 lines
testcases/lib/tst_test.sh +1
-1_tst_do_exit() {@@ -459,7 +459,7 @@ _tst_setup_timer() tst_res TINFO "timeout per run is ${h}h ${m}m ${s}s" - sleep $sec && tst_res TBROK "test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && kill -9 -$pid & + sleep $sec && tst_res TBROK "test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && { kill -2 -$pid; sleep 5; kill -9 -$pid; } &
Can we move the timeout handling to a separate function? This is getting a tiny bit unreadable...
Can this work?:_tst_handle_timeout()
{
??? tst_res TBROK ...
??? kill ....
}
...
sleep $sec && _tst_handle_timeout &
J?rg
RFC PATCH 1/1 tst_test.sh: Run cleanup also on timeout
Hi J?rg,
Quoted 7 lines
Hi,
Quoted 3 lines · Petr Vorel
Also timeout requires to run a test cleanup (e.g.
zram01.sh). Thus send first SIGINT, but keep also SIGKILL for safety reasons (after 5 sec to give cleanup function some time.+1
Quoted 10 lines
testcases/lib/tst_test.sh export TST_LIB_LOADED=1 · line 23
Quoted 9 lines
testcases/lib/tst_test.sh +1
-1@@ -21,7 +21,7 @@ export TST_LIB_LOADED=1 . tst_security.sh # default trap function -trap "tst_brk TBROK 'test interrupted'" INT +trap "tst_brk TBROK 'test interrupted or timeout'" INTshould be "timed out" for consistency
You probably mean consistency with TST_RETRY_FN_EXP_BACKOFF()
I tried to be consistent with previous message:
zram01 1 TBROK: test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1 That one should be changed as well.
I slightly prefer "timeout", but I'm not a native speaker.
Quoted 8 lines
testcases/lib/tst_test.sh _tst_setup_timer() · line 460
Quoted 6 lines
testcases/lib/tst_test.sh +1
-1_tst_do_exit() {@@ -459,7 +459,7 @@ _tst_setup_timer() tst_res TINFO "timeout per run is ${h}h ${m}m ${s}s" - sleep $sec && tst_res TBROK "test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && kill -9 -$pid & + sleep $sec && tst_res TBROK "test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && { kill -2 -$pid; sleep 5; kill -9 -$pid; } &Can we move the timeout handling to a separate function? This is getting a tiny bit unreadable...
Quoted 8 lines
Can this work?:
_tst_handle_timeout()
{
???tst_resTBROK ...
??? kill ....
}
...
sleep $sec &&_tst_handle_timeout&
+1.
Thanks!
Kind regards,
Petr
Quoted 1 line
J?rg
RFC PATCH 1/1 tst_test.sh: Run cleanup also on timeout
Hi Petr,
Quoted 10 lines
Quoted 10 lines
testcases/lib/tst_test.sh export TST_LIB_LOADED=1 · line 23
Quoted 9 lines
testcases/lib/tst_test.sh +1
-1@@ -21,7 +21,7 @@ export TST_LIB_LOADED=1 . tst_security.sh # default trap function -trap "tst_brk TBROK 'test interrupted'" INT +trap "tst_brk TBROK 'test interrupted or timeout'" INTshould be "timed out" for consistency
Quoted 5 lines
You probably mean consistency with
TST_RETRY_FN_EXP_BACKOFF()
I tried to be consistent with previous message:
zram01 1 TBROK: test killed, timeout! If you are running on slow machine, try exportingLTP_TIMEOUT_MUL> 1 That one should be changed as well.
I slightly prefer "timeout", but I'm not a native speaker.
No I was meant the "test interrupted" part. "test interrupt or timeout" would be consistent.
I am not a native speaker either, but "test interrupted or timed out" sound more correct to me.
J?rg