All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] fsync02: multiply the timediff if test in VM
@ 2022-04-11  9:40 Li Wang
  2022-04-19  5:18 ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2022-04-11  9:40 UTC (permalink / raw)
  To: ltp

Similar to 59e73f2 ("clock_gettime04: multiply the
timediff if test in VM"), extend tolerance for this test too.

  fsync02.c:93: TFAIL: fsync took too long: 167.000000 seconds;
                max_block: 17768; data_blocks: 2287

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/fsync/fsync02.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/fsync/fsync02.c b/testcases/kernel/syscalls/fsync/fsync02.c
index fcdc14f89..e6704b3a5 100644
--- a/testcases/kernel/syscalls/fsync/fsync02.c
+++ b/testcases/kernel/syscalls/fsync/fsync02.c
@@ -21,13 +21,13 @@
 
 #define BLOCKSIZE 8192
 #define MAXBLKS 65536
-#define TIME_LIMIT 120
 #define BUF_SIZE 2048
 
 char tempfile[40] = "";
 char pbuf[BUF_SIZE];
 int fd;
 off_t max_blks = MAXBLKS;
+int time_limit = 120;
 
 struct statvfs stat_buf;
 
@@ -35,6 +35,11 @@ static void setup(void) {
 	/* free blocks avail to non-superuser */
 	unsigned long f_bavail;
 
+	if (tst_is_virt(VIRT_ANY)) {
+		tst_res(TINFO, "Running in a VM, multiply the time_limit by 2.");
+		time_limit *= 2;
+	}
+
 	fd = SAFE_OPEN("tempfile", O_RDWR | O_CREAT | O_TRUNC, 0777);
 
 	if (fstatvfs(fd, &stat_buf) != 0) {
@@ -89,7 +94,7 @@ static void run(void) {
 		"timer broken end %ld < start %ld",
 		time_end, time_start);
 	} else if ((time_delta =
-		difftime(time_end, time_start)) > TIME_LIMIT) {
+		difftime(time_end, time_start)) > time_limit) {
 		tst_res(TFAIL,
 		"fsync took too long: %lf seconds; "
 		"max_block: %d; data_blocks: %d",
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] fsync02: multiply the timediff if test in VM
  2022-04-11  9:40 [LTP] [PATCH] fsync02: multiply the timediff if test in VM Li Wang
@ 2022-04-19  5:18 ` Petr Vorel
  2022-04-19  6:16   ` Li Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2022-04-19  5:18 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li,

> Similar to 59e73f2 ("clock_gettime04: multiply the
> timediff if test in VM"), extend tolerance for this test too.

>   fsync02.c:93: TFAIL: fsync took too long: 167.000000 seconds;
>                 max_block: 17768; data_blocks: 2287

Make sense.

Acked-by: Petr Vorel <pvorel@suse.cz>

> +	if (tst_is_virt(VIRT_ANY)) {
> +		tst_res(TINFO, "Running in a VM, multiply the time_limit by 2.");
very nit: why dot at the end?
> +		time_limit *= 2;
> +	}

Kind regards,
Petr


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] fsync02: multiply the timediff if test in VM
  2022-04-19  5:18 ` Petr Vorel
@ 2022-04-19  6:16   ` Li Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Li Wang @ 2022-04-19  6:16 UTC (permalink / raw)
  To: Petr Vorel; +Cc: LTP List


[-- Attachment #1.1: Type: text/plain, Size: 618 bytes --]

On Tue, Apr 19, 2022 at 1:18 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li,
>
> > Similar to 59e73f2 ("clock_gettime04: multiply the
> > timediff if test in VM"), extend tolerance for this test too.
>
> >   fsync02.c:93: TFAIL: fsync took too long: 167.000000 seconds;
> >                 max_block: 17768; data_blocks: 2287
>
> Make sense.
>
> Acked-by: Petr Vorel <pvorel@suse.cz>
>
> > +     if (tst_is_virt(VIRT_ANY)) {
> > +             tst_res(TINFO, "Running in a VM, multiply the time_limit
> by 2.");
> very nit: why dot at the end?
>

Pushed (without that dot), thanks for reviewing.


-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 1344 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-19  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11  9:40 [LTP] [PATCH] fsync02: multiply the timediff if test in VM Li Wang
2022-04-19  5:18 ` Petr Vorel
2022-04-19  6:16   ` Li Wang

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.