[LTP] [PATCH] fsync02: multiply the timediff if test in VM
Li Wang
liwang@redhat.com
Mon Apr 11 11:40:19 CEST 2022
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
More information about the ltp
mailing list