<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Petr,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for your working.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 13, 2019 at 8:58 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"><br></blockquote><div class="gmail_default" style="font-size:small"><snip></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
--- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh<br>
+++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh<br>
@@ -17,7 +17,7 @@ TST_NEEDS_CMDS="mount umount cat kill mkdir rmdir grep awk cut"<br>
<br>
# Each test case runs for 900 secs when everything fine<br>
# therefore the default 5 mins timeout is not enough.<br>
-LTP_TIMEOUT_MUL=7<br>
+TST_TIMEOUT=2100<br>
<br>
. cgroup_lib.sh<br>
<br>
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh<br>
index ca63745fd..b206fc0bb 100644<br>
--- a/testcases/lib/tst_test.sh<br>
+++ b/testcases/lib/tst_test.sh<br>
@@ -379,9 +379,41 @@ _tst_rescmp()<br>
<br>
_tst_setup_timer()<br>
{<br>
+ TST_TIMEOUT=${TST_TIMEOUT:-300}<br>
LTP_TIMEOUT_MUL=${LTP_TIMEOUT_MUL:-1}<br>
<br>
- local sec=$((300 * LTP_TIMEOUT_MUL))<br>
+ if [ "$TST_TIMEOUT" = -1 ]; then<br>
+ tst_res TINFO "Timeout per run is disabled"<br>
+ return<br>
+ fi<br>
+<br>
+ local err is_float<br>
+ if tst_is_num "$LTP_TIMEOUT_MUL"; then<br>
+ if tst_is_int "$LTP_TIMEOUT_MUL"; then<br>
+ [ "$LTP_TIMEOUT_MUL" -ge 1 ] || err=1<br>
+ else<br>
+ tst_test_cmds awk<br>
+ echo | awk '{if ('"$LTP_TIMEOUT_MUL"' < 1) {exit 1}}' || err=1<br>
+ is_float=1<br>
+ fi<br>
+ else<br>
+ err=1<br>
+ fi<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I'm OK to allow $LTP_TIMEOUT_MUL being float. But here I don't see what's enough reason to add the is_float variable. Because we could use the float expression for both types comparing, isn't it?</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ if [ "$err" ]; then<br>
+ tst_brk TCONF "LTP_TIMEOUT_MUL must be number >= 1! ($LTP_TIMEOUT_MUL)"<br>
+ fi<br>
+<br>
+ if ! tst_is_int "$TST_TIMEOUT" || [ "$TST_TIMEOUT" -lt 1 ]; then<br>
+ tst_brk TBROK "TST_TIMEOUT must be int >= 1! ($TST_TIMEOUT)"<br>
+ fi<br>
+<br>
+ local sec<br>
+ if [ "$is_float" ]; then<br>
+ sec=`echo |awk '{printf("%d\n", '$TST_TIMEOUT' * '$LTP_TIMEOUT_MUL')}'`<br>
+ else<br>
+ sec=$((TST_TIMEOUT * LTP_TIMEOUT_MUL))<br>
+ fi<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Here as well, why we need to distinguish the float and int, is the float expression does not work for integer? </div></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>