@@ -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_iteration_runtime = 1800,
.options = (struct tst_option[]) {
{"n:", &str_numchildren, "Number of threads (default 8)"},
{"w:", &str_writesize, "Size of writing blocks (default 32M)"},
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(+)