* [LTP] [PATCH] clock_gettime03: multiply the timediff if test in VM
@ 2022-01-27 10:09 Jan Stancek
2022-01-27 13:52 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2022-01-27 10:09 UTC (permalink / raw)
To: ltp
Similar to 59e73f295dc7 ("clock_gettime04: multiply the
timediff if test in VM"), extend tolerance for this test too.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../kernel/syscalls/clock_gettime/clock_gettime03.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
index 83e97d90726d..f185977d36df 100644
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
+++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
@@ -37,6 +37,7 @@ static struct tcase {
static struct tst_ts now, then, parent_then;
static int parent_ns;
+static long long delta = 10;
static struct time64_variants variants[] = {
{ .clock_gettime = libc_clock_gettime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
@@ -70,7 +71,7 @@ static void child(struct time64_variants *tv, struct tcase *tc)
diff = tst_ts_diff_ms(then, now);
- if (diff - tc->off * 1000 > 10) {
+ if (diff - tc->off * 1000 > delta) {
tst_res(TFAIL, "Wrong offset (%s) read %llims",
tst_clock_name(tc->clk_id), diff);
} else {
@@ -80,7 +81,7 @@ static void child(struct time64_variants *tv, struct tcase *tc)
diff = tst_ts_diff_ms(parent_then, now);
- if (diff > 10) {
+ if (diff > delta) {
tst_res(TFAIL, "Wrong offset (%s) read %llims",
tst_clock_name(tc->clk_id), diff);
} else {
@@ -113,6 +114,11 @@ static void setup(void)
{
struct time64_variants *tv = &variants[tst_variant];
+ if (tst_is_virt(VIRT_ANY)) {
+ tst_res(TINFO, "Running in a VM, multiply the delta by 10.");
+ delta *= 10;
+ }
+
now.type = then.type = parent_then.type = tv->ts_type;
tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
parent_ns = SAFE_OPEN("/proc/self/ns/time_for_children", O_RDONLY);
--
2.27.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] clock_gettime03: multiply the timediff if test in VM
2022-01-27 10:09 [LTP] [PATCH] clock_gettime03: multiply the timediff if test in VM Jan Stancek
@ 2022-01-27 13:52 ` Petr Vorel
2022-01-28 3:03 ` Li Wang
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2022-01-27 13:52 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp
Hi Jan,
> Similar to 59e73f295dc7 ("clock_gettime04: multiply the
> timediff if test in VM"), extend tolerance for this test too.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Makes sense, thanks!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] clock_gettime03: multiply the timediff if test in VM
2022-01-27 13:52 ` Petr Vorel
@ 2022-01-28 3:03 ` Li Wang
0 siblings, 0 replies; 3+ messages in thread
From: Li Wang @ 2022-01-28 3:03 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
On Thu, Jan 27, 2022 at 9:52 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Jan,
>
> > Similar to 59e73f295dc7 ("clock_gettime04: multiply the
> > timediff if test in VM"), extend tolerance for this test too.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Makes sense, thanks!
Patch merged, thanks~
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-28 3:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-27 10:09 [LTP] [PATCH] clock_gettime03: multiply the timediff if test in VM Jan Stancek
2022-01-27 13:52 ` Petr Vorel
2022-01-28 3:03 ` Li Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox