[LTP] [PATCH 2/3] io_pgetevents{01,02}: Handle no AIO support
Richard Palethorpe
rpalethorpe@suse.com
Wed Sep 30 16:50:08 CEST 2020
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c | 8 +++++---
testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c
index 2a1aad8d9..a0b56d814 100644
--- a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c
+++ b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c
@@ -51,9 +51,11 @@ static void run(void)
fd = SAFE_OPEN("io_pgetevents_file", O_RDWR | O_CREAT, 0644);
io_prep_pwrite(&cb, fd, data, 4096, 0);
- ret = io_setup(1, &ctx);
- if (ret < 0)
- tst_brk(TBROK | TERRNO, "io_setup() failed");
+ TEST(io_setup(1, &ctx));
+ if (TST_RET == -ENOSYS)
+ tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
+ if (TST_RET < 0)
+ tst_brk(TBROK | TRERRNO, "io_setup() failed");
ret = io_submit(ctx, 1, cbs);
if (ret != 1)
diff --git a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c
index 28afdb4a0..af71e17fe 100644
--- a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c
+++ b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c
@@ -65,9 +65,11 @@ static void setup(void)
fd = SAFE_OPEN("io_pgetevents_file", O_RDWR | O_CREAT, 0644);
io_prep_pwrite(&cb, fd, data, 4096, 0);
- ret = io_setup(1, &ctx);
- if (ret < 0)
- tst_brk(TBROK | TERRNO, "io_setup() failed");
+ TEST(io_setup(1, &ctx));
+ if (TST_RET == -ENOSYS)
+ tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
+ if (TST_RET < 0)
+ tst_brk(TBROK | TRERRNO, "io_setup() failed");
ctx_initialized = 1;
--
2.28.0
More information about the ltp
mailing list