[LTP] [PATCH 6/7] tst_test.sh: Run cleanup also after test timeout
Cyril Hrubis
chrubis@suse.cz
Thu Mar 11 14:49:02 CET 2021
Hi!
> > > _tst_cleanup_timer()
> > > {
> > > @@ -442,6 +442,14 @@ _tst_multiply_timeout()
> > > return 0
> > > }
>
> > > +_tst_run_timer()
>
>
> > Hmm, this name is not good than before, or rename to _tst_kill_timer_pid(),
> > _tst_stop_timer()?
>
> Good point. I slightly prefer _tst_stop_timer, but no hard feeling about it.
Or _tst_kill_test()?
> > > +{
> > > + tst_res TBROK "test killed, timeout! If you are running on slow
> > > machine, try exporting LTP_TIMEOUT_MUL > 1"
> > > + kill -INT -$pid
> > > + sleep 5
> > > + kill -KILL -$pid
Maybe we should change the messages to reflect what is happening and
maybe we should check if the test is still running before sending
SIGKILL with kill -0 $pid?
tst_res TBROK "Test timeouted, sending SIGINT, ...."
kill -INT -$pid
sleep 5
if kill -0 $pid 2>&1 > /dev/null; then
tst_res TBROK "Test still running, sending SIGKILL"
kill -KILL -$pid
fi
We can also bussy loop wait for the process to terminate, e.g. loop 10
times with sleep 1 in the body and break the loop if kill -0 $pid
returns failure.
> > > +}
> > > +
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list