Skip to contentSkip to conversation

fsync02: multiply the timediff if test in VM

PATCH In review Li Wang 2 participants 3 messages Apr 11, 2022 – Apr 19, 2022

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 fsync02: multiply the timediff if test in VM

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
---
 testcases/kernel/syscalls/fsync/fsync02.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/fsync/fsync02.c +7 -2
index fcdc14f89..e6704b3a5 100644
@@ -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",
Signature · 5 lines
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v1 1/1
#1 lore raw

Hi Li,

Quoted 5 lines

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.

testcases/kernel/syscalls/fsync/fsync02.c static void setup(void) { · line 39

Quoted 2 lines
testcases/kernel/syscalls/fsync/fsync02.c +2 -0
+	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?

testcases/kernel/syscalls/fsync/fsync02.c static void setup(void) { · line 41

Quoted 2 lines
testcases/kernel/syscalls/fsync/fsync02.c +2 -0
+		time_limit *= 2;
+	}

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw
Quoted 8 lines · Petr Vorel

Hi Li,

Quoted 5 lines

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
Quoted 9 lines

Make sense.

Review

Quoted 2 lines
(quoted diff) +2 -0
+     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.

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp