public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] eventfd06: add AIO support check
@ 2025-01-21  8:22 Li Wang
  2025-01-21  9:26 ` Petr Vorel
  2025-01-21 16:14 ` Cyril Hrubis
  0 siblings, 2 replies; 6+ messages in thread
From: Li Wang @ 2025-01-21  8:22 UTC (permalink / raw)
  To: ltp

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

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/eventfd/eventfd06.c b/testcases/kernel/syscalls/eventfd/eventfd06.c
index 7339dd471..46d7f73d3 100644
--- a/testcases/kernel/syscalls/eventfd/eventfd06.c
+++ b/testcases/kernel/syscalls/eventfd/eventfd06.c
@@ -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));
 
-- 
2.48.1


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] eventfd06: add AIO support check
  2025-01-21  8:22 [LTP] [PATCH] eventfd06: add AIO support check Li Wang
@ 2025-01-21  9:26 ` Petr Vorel
  2025-01-21 10:33   ` Li Wang
  2025-01-21 16:14 ` Cyril Hrubis
  1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2025-01-21  9:26 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

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

> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>  testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
>  1 file changed, 2 insertions(+)

> diff --git a/testcases/kernel/syscalls/eventfd/eventfd06.c b/testcases/kernel/syscalls/eventfd/eventfd06.c
> index 7339dd471..46d7f73d3 100644
> --- a/testcases/kernel/syscalls/eventfd/eventfd06.c
> +++ b/testcases/kernel/syscalls/eventfd/eventfd06.c
> @@ -136,6 +136,8 @@ static void test_poll(void)
>  static void setup(void)
>  {
>  	TEST(io_setup(MAXEVENTS, &ctx));
> +	if (TST_RET == -ENOSYS)

Reviewed-by: Petr Vorel <pvorel@suse.cz>

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

> +		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));

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] eventfd06: add AIO support check
  2025-01-21  9:26 ` Petr Vorel
@ 2025-01-21 10:33   ` Li Wang
  2025-01-21 11:13     ` Petr Vorel
  0 siblings, 1 reply; 6+ messages in thread
From: Li Wang @ 2025-01-21 10:33 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

On Tue, Jan 21, 2025 at 5:26 PM Petr Vorel <pvorel@suse.cz> wrote:

> > Just like what we did for io_setup01.c to avoid ENOSYS error:
> >   eventfd06.c:140: TBROK: io_setup() failed: ENOSYS
>
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> >  testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
> >  1 file changed, 2 insertions(+)
>
> > diff --git a/testcases/kernel/syscalls/eventfd/eventfd06.c
> b/testcases/kernel/syscalls/eventfd/eventfd06.c
> > index 7339dd471..46d7f73d3 100644
> > --- a/testcases/kernel/syscalls/eventfd/eventfd06.c
> > +++ b/testcases/kernel/syscalls/eventfd/eventfd06.c
> > @@ -136,6 +136,8 @@ static void test_poll(void)
> >  static void setup(void)
> >  {
> >       TEST(io_setup(MAXEVENTS, &ctx));
> > +     if (TST_RET == -ENOSYS)
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> 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) ... "




>
> 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.


> Kind regards,
> Petr
>
> > +             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));
>
>

-- 
Regards,
Li Wang

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] eventfd06: add AIO support check
  2025-01-21 10:33   ` Li Wang
@ 2025-01-21 11:13     ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2025-01-21 11:13 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li,
...
> > > +     if (TST_RET == -ENOSYS)

> > Reviewed-by: Petr Vorel <pvorel@suse.cz>

> > 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) ... "

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

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] eventfd06: add AIO support check
  2025-01-21  8:22 [LTP] [PATCH] eventfd06: add AIO support check Li Wang
  2025-01-21  9:26 ` Petr Vorel
@ 2025-01-21 16:14 ` Cyril Hrubis
  2025-01-22  1:50   ` Li Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2025-01-21 16:14 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi!
> Just like what we did for io_setup01.c to avoid ENOSYS error:
>   eventfd06.c:140: TBROK: io_setup() failed: ENOSYS
> 
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>  testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/eventfd/eventfd06.c b/testcases/kernel/syscalls/eventfd/eventfd06.c
> index 7339dd471..46d7f73d3 100644
> --- a/testcases/kernel/syscalls/eventfd/eventfd06.c
> +++ b/testcases/kernel/syscalls/eventfd/eventfd06.c
> @@ -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:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] eventfd06: add AIO support check
  2025-01-21 16:14 ` Cyril Hrubis
@ 2025-01-22  1:50   ` Li Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Li Wang @ 2025-01-22  1:50 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

On Wed, Jan 22, 2025 at 12:14 AM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > Just like what we did for io_setup01.c to avoid ENOSYS error:
> >   eventfd06.c:140: TBROK: io_setup() failed: ENOSYS
> >
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> >  testcases/kernel/syscalls/eventfd/eventfd06.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/testcases/kernel/syscalls/eventfd/eventfd06.c
> b/testcases/kernel/syscalls/eventfd/eventfd06.c
> > index 7339dd471..46d7f73d3 100644
> > --- a/testcases/kernel/syscalls/eventfd/eventfd06.c
> > +++ b/testcases/kernel/syscalls/eventfd/eventfd06.c
> > @@ -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:
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>

Patch merged, thanks.

-- 
Regards,
Li Wang

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-22  1:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-21  8:22 [LTP] [PATCH] eventfd06: add AIO support check Li Wang
2025-01-21  9:26 ` Petr Vorel
2025-01-21 10:33   ` Li Wang
2025-01-21 11:13     ` Petr Vorel
2025-01-21 16:14 ` Cyril Hrubis
2025-01-22  1:50   ` Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox