<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 9, 2018 at 3:29 PM, Jan Stancek <span dir="ltr"><<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">times() runs immediately after fork(), but syscall alone<br>
seems to be enough for some systems to already account ticks.<br>
<br>
For example on arm64 with 4.14:<br>
  tst_test.c:980: INFO: Timeout per run is 0h 05m 00s<br>
  times03.c:102: PASS: buf1.tms_utime = 0<br>
  times03.c:105: FAIL: buf1.tms_stime = 1<br>
  ...<br>
<br>
This patch replaces zero check with a comparison against a small<br>
enough number < 5 (which should be between 5ms and 50ms depending<br>
on CONFIG_HZ).<br>
<br>
Suggested-by: Cyril Hrubis <<a href="mailto:chrubis@suse.cz" target="_blank">chrubis@suse.cz</a>><br>
Signed-off-by: Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>><br>
---<br>
 testcases/kernel/syscalls/tim<wbr>es/times03.c | 8 ++++----<br>
 1 file changed, 4 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/testcases/kernel/syscalls/ti<wbr>mes/times03.c b/testcases/kernel/syscalls/ti<wbr>mes/times03.c<br>
index 78d72d259ec1..c34faf5a2ff9 100644<br>
--- a/testcases/kernel/syscalls/ti<wbr>mes/times03.c<br>
+++ b/testcases/kernel/syscalls/ti<wbr>mes/times03.c<br>
@@ -96,15 +96,15 @@ static void verify_times(void)<br>
        if (times(&buf1) == -1)<br>
                tst_brk(TBROK | TERRNO, "times()");<br>
<br>
-       if (buf1.tms_utime != 0)<br>
+       if (buf1.tms_utime > 5)<br>
                tst_res(TFAIL, "buf1.tms_utime = %li", buf1.tms_utime);<br>
        else<br>
-               tst_res(TPASS, "buf1.tms_utime = 0");<br>
+               tst_res(TPASS, "<div style="font-family:monospace,monospace;display:inline" class="gmail_default">​​</div>buf1.tms_utime > 5");<br></blockquote><div><br><div style="font-family:monospace,monospace" class="gmail_default">​shouldn't this ​buf1.tms_utime <= 5 ?​</div><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>
-       if (buf1.tms_stime != 0)<br>
+       if (buf1.tms_stime > 5)<br>
                tst_res(TFAIL, "buf1.tms_stime = %li", buf1.tms_stime);<br>
        else<br>
-               tst_res(TPASS, "buf1.tms_stime = 0");<br>
+               tst_res(TPASS, "buf1.tms_stime > 5");<br></blockquote><div><br><div style="font-family:monospace,monospace;display:inline" class="gmail_default">​here as well.<br>​</div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
        generate_utime();<br>
        generate_stime();<br>
<span class="m_528918135932308412m_-7253638617488939001gmail-HOEnZb"><font color="#888888">--<br>
1.8.3.1<br>
<br>
</font></span></blockquote></div><br><div style="font-family:monospace,monospace" class="gmail_default">​Other than that this looks good to me. I also run this changes more than 100 times and ​all passed.<br></div><br><br clear="all"><br>-- <br><div class="m_528918135932308412m_-7253638617488939001gmail_signature"><div dir="ltr">Regards,<br>Li Wang<br>Email: <a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a><br></div></div>
</div></div>