[LTP] [PATCH v3 26/29] ltp-aiodio/dio_read: Convert to runtime
Cyril Hrubis
chrubis@suse.cz
Thu May 12 14:38:13 CEST 2022
And cap the runtime on 30 minutes by default.
CC: Andrea Cervesato <andrea.cervesato@suse.de>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
testcases/kernel/io/ltp-aiodio/dio_read.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/testcases/kernel/io/ltp-aiodio/dio_read.c b/testcases/kernel/io/ltp-aiodio/dio_read.c
index f6ed59782..d28d474db 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_read.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_read.c
@@ -51,6 +51,9 @@ static void do_buffered_writes(int fd, char *bufptr, long long fsize, long long
tst_brk(TBROK, "pwrite: wrote %lld bytes out of %lld", w, wsize);
SAFE_FSYNC(fd);
+
+ if (!tst_remaining_runtime())
+ return;
}
}
@@ -75,6 +78,11 @@ static int do_direct_reads(char *filename, char *bufptr, long long fsize, long l
goto exit;
}
+ if (!tst_remaining_runtime()) {
+ tst_res(TINFO, "Test out of runtime, exitting");
+ goto exit;
+ }
+
w = pread(fd, bufptr, rsize, offset);
if (w < 0)
tst_brk(TBROK, "pread: %s", tst_strerrno(-w));
@@ -170,6 +178,7 @@ static struct tst_test test = {
.cleanup = cleanup,
.needs_tmpdir = 1,
.forks_child = 1,
+ .max_runtime = 1800,
.options = (struct tst_option[]) {
{"n:", &str_numchildren, "Number of threads (default 8)"},
{"w:", &str_writesize, "Size of writing blocks (default 32M)"},
--
2.35.1
More information about the ltp
mailing list