* [LTP] [PATCH v2] times03: don't assume process initial [us]time is 0
@ 2018-03-09 7:29 Jan Stancek
2018-03-09 9:48 ` Li Wang
0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2018-03-09 7:29 UTC (permalink / raw)
To: ltp
times() runs immediately after fork(), but syscall alone
seems to be enough for some systems to already account ticks.
For example on arm64 with 4.14:
tst_test.c:980: INFO: Timeout per run is 0h 05m 00s
times03.c:102: PASS: buf1.tms_utime = 0
times03.c:105: FAIL: buf1.tms_stime = 1
...
This patch replaces zero check with a comparison against a small
enough number < 5 (which should be between 5ms and 50ms depending
on CONFIG_HZ).
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/times/times03.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/times/times03.c b/testcases/kernel/syscalls/times/times03.c
index 78d72d259ec1..c34faf5a2ff9 100644
--- a/testcases/kernel/syscalls/times/times03.c
+++ b/testcases/kernel/syscalls/times/times03.c
@@ -96,15 +96,15 @@ static void verify_times(void)
if (times(&buf1) == -1)
tst_brk(TBROK | TERRNO, "times()");
- if (buf1.tms_utime != 0)
+ if (buf1.tms_utime > 5)
tst_res(TFAIL, "buf1.tms_utime = %li", buf1.tms_utime);
else
- tst_res(TPASS, "buf1.tms_utime = 0");
+ tst_res(TPASS, "buf1.tms_utime > 5");
- if (buf1.tms_stime != 0)
+ if (buf1.tms_stime > 5)
tst_res(TFAIL, "buf1.tms_stime = %li", buf1.tms_stime);
else
- tst_res(TPASS, "buf1.tms_stime = 0");
+ tst_res(TPASS, "buf1.tms_stime > 5");
generate_utime();
generate_stime();
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2] times03: don't assume process initial [us]time is 0
2018-03-09 7:29 [LTP] [PATCH v2] times03: don't assume process initial [us]time is 0 Jan Stancek
@ 2018-03-09 9:48 ` Li Wang
2018-03-09 10:05 ` Jan Stancek
0 siblings, 1 reply; 5+ messages in thread
From: Li Wang @ 2018-03-09 9:48 UTC (permalink / raw)
To: ltp
On Fri, Mar 9, 2018 at 3:29 PM, Jan Stancek <jstancek@redhat.com> wrote:
> times() runs immediately after fork(), but syscall alone
> seems to be enough for some systems to already account ticks.
>
> For example on arm64 with 4.14:
> tst_test.c:980: INFO: Timeout per run is 0h 05m 00s
> times03.c:102: PASS: buf1.tms_utime = 0
> times03.c:105: FAIL: buf1.tms_stime = 1
> ...
>
> This patch replaces zero check with a comparison against a small
> enough number < 5 (which should be between 5ms and 50ms depending
> on CONFIG_HZ).
>
> Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> testcases/kernel/syscalls/times/times03.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/times/times03.c
> b/testcases/kernel/syscalls/times/times03.c
> index 78d72d259ec1..c34faf5a2ff9 100644
> --- a/testcases/kernel/syscalls/times/times03.c
> +++ b/testcases/kernel/syscalls/times/times03.c
> @@ -96,15 +96,15 @@ static void verify_times(void)
> if (times(&buf1) == -1)
> tst_brk(TBROK | TERRNO, "times()");
>
> - if (buf1.tms_utime != 0)
> + if (buf1.tms_utime > 5)
> tst_res(TFAIL, "buf1.tms_utime = %li", buf1.tms_utime);
> else
> - tst_res(TPASS, "buf1.tms_utime = 0");
> + tst_res(TPASS, "
>
> buf1.tms_utime > 5");
>
shouldn't this buf1.tms_utime <= 5 ?
>
> - if (buf1.tms_stime != 0)
> + if (buf1.tms_stime > 5)
> tst_res(TFAIL, "buf1.tms_stime = %li", buf1.tms_stime);
> else
> - tst_res(TPASS, "buf1.tms_stime = 0");
> + tst_res(TPASS, "buf1.tms_stime > 5");
>
here as well.
>
> generate_utime();
> generate_stime();
> --
> 1.8.3.1
>
>
Other than that this looks good to me. I also run this changes more than
100 times and all passed.
--
Regards,
Li Wang
Email: liwang@redhat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20180309/8fd371fd/attachment-0001.html>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2] times03: don't assume process initial [us]time is 0
2018-03-09 9:48 ` Li Wang
@ 2018-03-09 10:05 ` Jan Stancek
2018-03-09 12:01 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2018-03-09 10:05 UTC (permalink / raw)
To: ltp
----- Original Message -----
> On Fri, Mar 9, 2018 at 3:29 PM, Jan Stancek <jstancek@redhat.com> wrote:
>
> > times() runs immediately after fork(), but syscall alone
> > seems to be enough for some systems to already account ticks.
> >
> > For example on arm64 with 4.14:
> > tst_test.c:980: INFO: Timeout per run is 0h 05m 00s
> > times03.c:102: PASS: buf1.tms_utime = 0
> > times03.c:105: FAIL: buf1.tms_stime = 1
> > ...
> >
> > This patch replaces zero check with a comparison against a small
> > enough number < 5 (which should be between 5ms and 50ms depending
> > on CONFIG_HZ).
> >
> > Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> > testcases/kernel/syscalls/times/times03.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/testcases/kernel/syscalls/times/times03.c
> > b/testcases/kernel/syscalls/times/times03.c
> > index 78d72d259ec1..c34faf5a2ff9 100644
> > --- a/testcases/kernel/syscalls/times/times03.c
> > +++ b/testcases/kernel/syscalls/times/times03.c
> > @@ -96,15 +96,15 @@ static void verify_times(void)
> > if (times(&buf1) == -1)
> > tst_brk(TBROK | TERRNO, "times()");
> >
> > - if (buf1.tms_utime != 0)
> > + if (buf1.tms_utime > 5)
> > tst_res(TFAIL, "buf1.tms_utime = %li", buf1.tms_utime);
> > else
> > - tst_res(TPASS, "buf1.tms_utime = 0");
> > + tst_res(TPASS, "
> >
> > buf1.tms_utime > 5");
> >
>
> shouldn't this buf1.tms_utime <= 5 ?
You're right, the TPASS message is wrong.
>
>
>
> >
> > - if (buf1.tms_stime != 0)
> > + if (buf1.tms_stime > 5)
> > tst_res(TFAIL, "buf1.tms_stime = %li", buf1.tms_stime);
> > else
> > - tst_res(TPASS, "buf1.tms_stime = 0");
> > + tst_res(TPASS, "buf1.tms_stime > 5");
> >
>
> here as well.
>
>
>
> >
> > generate_utime();
> > generate_stime();
> > --
> > 1.8.3.1
> >
> >
> Other than that this looks good to me. I also run this changes more than
> 100 times and all passed.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2] times03: don't assume process initial [us]time is 0
2018-03-09 10:05 ` Jan Stancek
@ 2018-03-09 12:01 ` Cyril Hrubis
2018-03-09 12:17 ` Jan Stancek
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2018-03-09 12:01 UTC (permalink / raw)
To: ltp
Hi!
> You're right, the TPASS message is wrong.
Acked with fixed TPASS messages.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2] times03: don't assume process initial [us]time is 0
2018-03-09 12:01 ` Cyril Hrubis
@ 2018-03-09 12:17 ` Jan Stancek
0 siblings, 0 replies; 5+ messages in thread
From: Jan Stancek @ 2018-03-09 12:17 UTC (permalink / raw)
To: ltp
----- Original Message -----
> Hi!
> > You're right, the TPASS message is wrong.
>
> Acked with fixed TPASS messages.
Pushed with fixed TPASS messages.
Regards,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-09 12:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-09 7:29 [LTP] [PATCH v2] times03: don't assume process initial [us]time is 0 Jan Stancek
2018-03-09 9:48 ` Li Wang
2018-03-09 10:05 ` Jan Stancek
2018-03-09 12:01 ` Cyril Hrubis
2018-03-09 12:17 ` Jan Stancek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.