From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Hrubis Date: Thu, 11 Mar 2021 14:49:02 +0100 Subject: [LTP] [PATCH 6/7] tst_test.sh: Run cleanup also after test timeout In-Reply-To: References: <20210301220222.22705-1-pvorel@suse.cz> <20210301220222.22705-7-pvorel@suse.cz> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it 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