<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Petr,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 2, 2021 at 3:38 PM Petr Vorel <<a href="mailto:pvorel@suse.cz">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Li,<br>
<br>
> On Sat, Jan 30, 2021 at 4:16 AM Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>> wrote:<br>
<br>
> > > Hi,<br>
<br>
> > > > + TST_TIMEOUT=$((dev_num*200))<br>
> > > Actually on heavy loaded machine this is not enough due BTRFS.<br>
> > > I can add something like dev_num*600 or even -1 (then previous commit<br>
> > would not<br>
> > > be needed, but IMHO still useful).<br>
<br>
<br>
> I personally think -1 is better.<br>
OK. In that case we might avoid now unneeded previous commit.<br>
<br>
<br>
<br>
> > And bad thing is that it breaks other zram tests, because the timer<br>
> > probably<br>
> > does not allow to run the cleanup:<br>
<br>
> > _tst_setup_timer()<br>
> > {<br>
> > ...<br>
> > sleep $sec && tst_res TBROK "test killed, timeout! If you are<br>
> > running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && kill -9<br>
> > -$pid &<br>
<br>
> > I'm not sure if shell allow us to do it better. Maybe sent different<br>
> > signal than<br>
> > SIGKILL and define 'trap _tst_do_exit' for that signal?<br>
<br>
<br>
> Sounds practicable. I guess sending SIGINT could make more sense, since<br>
> sometimes we use CTRL+C stop test in debugging by manual, test should<br>
> do cleanup work for that behavior too.<br>
We have already SIGINT defined for main shell process:<br>
trap "tst_brk TBROK 'test interrupted'" INT<br>
<br>
so CTRL+C is covered. So maybe run first SIGINT and then SIGKILL for safety<br>
reasons?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I'm fine with using SIGINT + SIGKILL.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default">Or, maybe another choice is to catch a signal SIGTERM? Once we</div><div class="gmail_default">cancel the specified signal in KILL command, it will try with SIGTERM</div><div class="gmail_default">by default, if the test process can not be terminated, then a SIGKILL</div><div class="gmail_default" style="font-size:small">may be sent.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--- a/testcases/lib/tst_test.sh<br>+++ b/testcases/lib/tst_test.sh<br>@@ -22,6 +22,7 @@ export TST_LIB_LOADED=1<br> <br> # default trap function<br> trap "tst_brk TBROK 'test interrupted'" INT<br>+trap "_tst_do_exit" TERM<br> <br> _tst_do_exit()<br> {<br>@@ -459,7 +460,7 @@ _tst_setup_timer()<br> <br> tst_res TINFO "timeout per run is ${h}h ${m}m ${s}s"<br> <br>- sleep $sec && tst_res TBROK "test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && kill -9 -$pid &<br>+ sleep $sec && tst_res TBROK "test terminated, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && kill -- -$pid &<br> <br> _tst_setup_timer_pid=$!<br></div></div><div><br></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>