Skip to contentSkip to conversation

eventfd06: add AIO support check

PATCH In review Li Wang 3 participants 6 messages Jan 21, 2025 – Jan 22, 2025

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 eventfd06: add AIO support check

Just like what we did for io_setup01.c to avoid ENOSYS error:
eventfd06.c:140: TBROK: io_setup() failed: ENOSYS

---
 testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/eventfd/eventfd06.c +2 -0
index 7339dd471..46d7f73d3 100644
@@ -136,6 +136,8 @@ static void test_poll(void)
 static void setup(void)
 {
 	TEST(io_setup(MAXEVENTS, &ctx));
+	if (TST_RET == -ENOSYS)
+		tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
 	if (TST_RET < 0)
 		tst_brk(TBROK, "io_setup() failed: %s", tst_strerrno(-TST_RET));
 
Signature · 5 lines
2.48.1


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

Just like what we did for io_setup01.c to avoid ENOSYS error:
eventfd06.c:140: TBROK: io_setup() failed: ENOSYS

---
 testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/eventfd/eventfd06.c +0 -0
index 7339dd471..46d7f73d3 100644

testcases/kernel/syscalls/eventfd/eventfd06.c static void test_poll(void) · line 139

Quoted 4 lines
testcases/kernel/syscalls/eventfd/eventfd06.c +1 -0
@@ -136,6 +136,8 @@ static void test_poll(void)
 static void setup(void)
 {
 	TEST(io_setup(MAXEVENTS, &ctx));
+	if (TST_RET == -ENOSYS)

Maybe to be safe to check also TST_RET?

if (TST_RET == -1 && TTERRNO == ENOSYS)

Maybe (after the release) we could add new macro to tst_test_macros.h similar to TEST(), which would do test like this (variant of tst_syscall() macro). We already have 10 tests which do this manually.

Kind regards,
Petr

Quoted 3 lines
testcases/kernel/syscalls/eventfd/eventfd06.c +1 -0
+		tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
 	if (TST_RET < 0)
 		tst_brk(TBROK, "io_setup() failed: %s", tst_strerrno(-TST_RET));
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw
Quoted 21 lines · Petr Vorel

Review

Quoted 9 lines

Just like what we did for io_setup01.c to avoid ENOSYS error:
eventfd06.c:140: TBROK: io_setup() failed: ENOSYS

---
 testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/testcases/kernel/syscalls/eventfd/eventfd06.c

testcases/kernel/syscalls/eventfd/eventfd06.c static void test_poll(void) · line 139

Quoted 8 lines

index 7339dd471..46d7f73d3 100644

testcases/kernel/syscalls/eventfd/eventfd06.c +1 -0
@@ -136,6 +136,8 @@ static void test_poll(void)
 static void setup(void)
 {
      TEST(io_setup(MAXEVENTS, &ctx));
+     if (TST_RET == -ENOSYS)
Quoted 4 lines

Maybe to be safe to check also TST_RET?

if (TST_RET == -1 && TTERRNO == ENOSYS)

I guess you mean: if (TST_RET == -1 && TST_ERR == ENOSYS).

Typically this is correct but here it's not right. Because according to the io_setup(2) - Linux man page:

"... Note also that the libaio wrapper does not follow the usual C library conventions for indicating errors: on error it returns a negated error number (the negative of one of the values listed in ERRORS) ... "

Quoted 5 lines

Maybe (after the release) we could add new macro to tst_test_macros.h similar to TEST(), which would do test like this (variant of tst_syscall() macro). We already have 10 tests which do this manually.

Sure.

Quoted 10 lines

Kind regards,
Petr

testcases/kernel/syscalls/eventfd/eventfd06.c static void test_poll(void) · line 140

Quoted 1 line
testcases/kernel/syscalls/eventfd/eventfd06.c +1 -0
+             tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by

kernel");

testcases/kernel/syscalls/eventfd/eventfd06.c static void test_poll(void) · line 142

Quoted 2 lines
testcases/kernel/syscalls/eventfd/eventfd06.c +0 -0
      if (TST_RET < 0)
              tst_brk(TBROK, "io_setup() failed: %s",

tst_strerrno(-TST_RET));

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi Li,
...

Quoted 10 lines
Quoted 7 lines
Quoted 1 line

+ if (TST_RET == -ENOSYS)

Maybe to be safe to check also TST_RET?

if (TST_RET == -1 && TTERRNO == ENOSYS)

I guess you mean: if (TST_RET == -1 && TST_ERR == ENOSYS).

Quoted 7 lines

Typically this is correct but here it's not right. Because according to the io_setup(2) - Linux man page:

"... Note also that the libaio wrapper does not follow the usual C library conventions for indicating errors: on error it returns a negated error number (the negative of one of the values listed in ERRORS) ... "

Ah, I'm sorry, I overlooked that.
I guess Cyril will ack this obvious fix today.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#4 lore raw
In reply to Li Wang

Hi!

Quoted 13 lines

Just like what we did for io_setup01.c to avoid ENOSYS error:
eventfd06.c:140: TBROK: io_setup() failed: ENOSYS

---
 testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/eventfd/eventfd06.c +0 -0
index 7339dd471..46d7f73d3 100644

testcases/kernel/syscalls/eventfd/eventfd06.c static void test_poll(void) · line 143

Quoted 8 lines
testcases/kernel/syscalls/eventfd/eventfd06.c +2 -0
@@ -136,6 +136,8 @@ static void test_poll(void)
 static void setup(void)
 {
 	TEST(io_setup(MAXEVENTS, &ctx));
+	if (TST_RET == -ENOSYS)
+		tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
 	if (TST_RET < 0)
 		tst_brk(TBROK, "io_setup() failed: %s", tst_strerrno(-TST_RET));
 

Alternatively we can add CONFIG_AIO to the needs_kconfigs but anyways:

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#5 lore raw
Quoted 21 lines · Cyril Hrubis

Hi!

Review

Quoted 9 lines

Just like what we did for io_setup01.c to avoid ENOSYS error:
eventfd06.c:140: TBROK: io_setup() failed: ENOSYS

---
 testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/testcases/kernel/syscalls/eventfd/eventfd06.c

testcases/kernel/syscalls/eventfd/eventfd06.c static void test_poll(void) · line 140

Quoted 9 lines

index 7339dd471..46d7f73d3 100644

testcases/kernel/syscalls/eventfd/eventfd06.c +2 -0
@@ -136,6 +136,8 @@ static void test_poll(void)
 static void setup(void)
 {
      TEST(io_setup(MAXEVENTS, &ctx));
+     if (TST_RET == -ENOSYS)
+             tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by

kernel");

Quoted 9 lines

testcases/kernel/syscalls/eventfd/eventfd06.c static void test_poll(void) · line 142

Quoted 2 lines
testcases/kernel/syscalls/eventfd/eventfd06.c +0 -0
      if (TST_RET < 0)
              tst_brk(TBROK, "io_setup() failed: %s",

tst_strerrno(-TST_RET));

Quoted 1 line

Alternatively we can add CONFIG_AIO to the needs_kconfigs but anyways:

Patch merged, thanks.

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp