All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [LTP] [PATCH] syscalls/io_submit: Add TTERRNO/TERRNO when test fail
@ 2022-04-19 12:05 zhaogongyi via ltp
  2022-04-19 13:14 ` Cyril Hrubis
  0 siblings, 1 reply; 5+ messages in thread
From: zhaogongyi via ltp @ 2022-04-19 12:05 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,


> 
> Hi!
> > Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> > ---
> >  testcases/kernel/syscalls/io_submit/io_submit01.c | 2 +-
> > testcases/kernel/syscalls/io_submit/io_submit02.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c
> > b/testcases/kernel/syscalls/io_submit/io_submit01.c
> > index db541fc01..ba75f6d81 100644
> > --- a/testcases/kernel/syscalls/io_submit/io_submit01.c
> > +++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
> > @@ -130,7 +130,7 @@ static void verify_io_submit(unsigned int n)
> >  		return;
> >  	}
> >
> > -	tst_res(TFAIL, "io_submit() returned %i(%s), expected %s(%i)",
> > +	tst_res(TFAIL | TERRNO, "io_submit() returned %i(%s), expected
> > +%s(%i)",
> >  		ret, ret < 0 ? tst_strerrno(-ret) : "SUCCESS",
> >  		errno_name(t->exp_errno), t->exp_errno);  }
> 
> NACK.
> 
> As far as I can tell the io_submit() calls returns negative error instead of
> setting errno, at least that's what libaio documentation states.

Yes, according to linux manual, libaio interface don't set errno when calling failed, so, do we also need to remove the TREENO here?

80         TEST(io_setup(1, &ctx));
81         if (TST_RET == -ENOSYS)
82                 tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
83         else if (TST_RET)
84                 tst_brk(TBROK | TRERRNO, "io_setup() failed");


> 
> > diff --git a/testcases/kernel/syscalls/io_submit/io_submit02.c
> > b/testcases/kernel/syscalls/io_submit/io_submit02.c
> > index 38b8555d8..6ba4d99a5 100644
> > --- a/testcases/kernel/syscalls/io_submit/io_submit02.c
> > +++ b/testcases/kernel/syscalls/io_submit/io_submit02.c
> > @@ -79,7 +79,7 @@ static void run(unsigned int i)
> >  	if (TST_RET == tc[i].nr)
> >  		tst_res(TPASS, "io_submit() %s", tc[i].desc);
> >  	else
> > -		tst_res(TFAIL, "io_submit() returns %ld, expected %ld", TST_RET,
> tc[i].nr);
> > +		tst_res(TFAIL | TTERRNO, "io_submit() returns %ld,
> expected %ld",
> > +TST_RET, tc[i].nr);
> 
> The best we can do here is to use tst_strerrno() to print the error as we do
> in the io_submit().

According to linux manual, call io_submit through syscall, it will set errno:
	"If the system call is invoked via syscall(2), then the return value follows the usual conventions for indicating an error: -1, with  errno  set  to  a
    (positive) value that indicates the error."


> 
> >  	for (j = 0; j < TST_RET; j++) {
> >  		tst_syscall(__NR_io_getevents, *tc[i].ctx, 1, 1, &evbuf,
> > --
> > 2.17.1
> >
> >
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
> 
> --
> Cyril Hrubis
> chrubis@suse.cz

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

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

* Re: [LTP] [PATCH] syscalls/io_submit: Add TTERRNO/TERRNO when test fail
  2022-04-19 12:05 [LTP] [PATCH] syscalls/io_submit: Add TTERRNO/TERRNO when test fail zhaogongyi via ltp
@ 2022-04-19 13:14 ` Cyril Hrubis
  0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2022-04-19 13:14 UTC (permalink / raw)
  To: zhaogongyi; +Cc: ltp

Hi!
> > 
> > NACK.
> > 
> > As far as I can tell the io_submit() calls returns negative error instead of
> > setting errno, at least that's what libaio documentation states.
> 
> Yes, according to linux manual, libaio interface don't set errno when calling failed, so, do we also need to remove the TREENO here?
> 
> 80         TEST(io_setup(1, &ctx));
> 81         if (TST_RET == -ENOSYS)
> 82                 tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
> 83         else if (TST_RET)
> 84                 tst_brk(TBROK | TRERRNO, "io_setup() failed");

Yes please, this should be replaced by manually printing
tst_strerrno(-TST_RET).

> > > diff --git a/testcases/kernel/syscalls/io_submit/io_submit02.c
> > > b/testcases/kernel/syscalls/io_submit/io_submit02.c
> > > index 38b8555d8..6ba4d99a5 100644
> > > --- a/testcases/kernel/syscalls/io_submit/io_submit02.c
> > > +++ b/testcases/kernel/syscalls/io_submit/io_submit02.c
> > > @@ -79,7 +79,7 @@ static void run(unsigned int i)
> > >  	if (TST_RET == tc[i].nr)
> > >  		tst_res(TPASS, "io_submit() %s", tc[i].desc);
> > >  	else
> > > -		tst_res(TFAIL, "io_submit() returns %ld, expected %ld", TST_RET,
> > tc[i].nr);
> > > +		tst_res(TFAIL | TTERRNO, "io_submit() returns %ld,
> > expected %ld",
> > > +TST_RET, tc[i].nr);
> > 
> > The best we can do here is to use tst_strerrno() to print the error as we do
> > in the io_submit().
> 
> According to linux manual, call io_submit through syscall, it will set errno:
> 	"If the system call is invoked via syscall(2), then the return value follows the usual conventions for indicating an error: -1, with  errno  set  to  a
>     (positive) value that indicates the error."

Ah right, as long as we use the syscall() wrapper the negative error
return value will be moved to the errno variable by the wrapper, so this
part is correct.

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH] syscalls/io_submit: Add TTERRNO/TERRNO when test fail
@ 2022-04-21 12:14 zhaogongyi via ltp
  0 siblings, 0 replies; 5+ messages in thread
From: zhaogongyi via ltp @ 2022-04-21 12:14 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

Thans for your review!

I have resubmit a patch, please see: https://patchwork.ozlabs.org/project/ltp/patch/20220421121016.26958-1-zhaogongyi@huawei.com/

Best wishes!

Gongyi

 
> Hi!
> > >
> > > NACK.
> > >
> > > As far as I can tell the io_submit() calls returns negative error
> > > instead of setting errno, at least that's what libaio documentation
> states.
> >
> > Yes, according to linux manual, libaio interface don't set errno when
> calling failed, so, do we also need to remove the TREENO here?
> >
> > 80         TEST(io_setup(1, &ctx));
> > 81         if (TST_RET == -ENOSYS)
> > 82                 tst_brk(TCONF | TRERRNO, "io_setup(): AIO not
> supported by kernel");
> > 83         else if (TST_RET)
> > 84                 tst_brk(TBROK | TRERRNO, "io_setup() failed");
> 
> Yes please, this should be replaced by manually printing
> tst_strerrno(-TST_RET).
> 
> > > > diff --git a/testcases/kernel/syscalls/io_submit/io_submit02.c
> > > > b/testcases/kernel/syscalls/io_submit/io_submit02.c
> > > > index 38b8555d8..6ba4d99a5 100644
> > > > --- a/testcases/kernel/syscalls/io_submit/io_submit02.c
> > > > +++ b/testcases/kernel/syscalls/io_submit/io_submit02.c
> > > > @@ -79,7 +79,7 @@ static void run(unsigned int i)
> > > >  	if (TST_RET == tc[i].nr)
> > > >  		tst_res(TPASS, "io_submit() %s", tc[i].desc);
> > > >  	else
> > > > -		tst_res(TFAIL, "io_submit() returns %ld, expected %ld",
> TST_RET,
> > > tc[i].nr);
> > > > +		tst_res(TFAIL | TTERRNO, "io_submit() returns %ld,
> > > expected %ld",
> > > > +TST_RET, tc[i].nr);
> > >
> > > The best we can do here is to use tst_strerrno() to print the error
> > > as we do in the io_submit().
> >
> > According to linux manual, call io_submit through syscall, it will set
> errno:
> > 	"If the system call is invoked via syscall(2), then the return value
> follows the usual conventions for indicating an error: -1, with  errno  set
> to  a
> >     (positive) value that indicates the error."
> 
> Ah right, as long as we use the syscall() wrapper the negative error return
> value will be moved to the errno variable by the wrapper, so this part is
> correct.
> 
> --
> Cyril Hrubis
> chrubis@suse.cz

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

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

* Re: [LTP] [PATCH] syscalls/io_submit: Add TTERRNO/TERRNO when test fail
  2022-04-19  8:50 Zhao Gongyi via ltp
@ 2022-04-19 11:40 ` Cyril Hrubis
  0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2022-04-19 11:40 UTC (permalink / raw)
  To: Zhao Gongyi; +Cc: ltp

Hi!
> Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> ---
>  testcases/kernel/syscalls/io_submit/io_submit01.c | 2 +-
>  testcases/kernel/syscalls/io_submit/io_submit02.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c b/testcases/kernel/syscalls/io_submit/io_submit01.c
> index db541fc01..ba75f6d81 100644
> --- a/testcases/kernel/syscalls/io_submit/io_submit01.c
> +++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
> @@ -130,7 +130,7 @@ static void verify_io_submit(unsigned int n)
>  		return;
>  	}
> 
> -	tst_res(TFAIL, "io_submit() returned %i(%s), expected %s(%i)",
> +	tst_res(TFAIL | TERRNO, "io_submit() returned %i(%s), expected %s(%i)",
>  		ret, ret < 0 ? tst_strerrno(-ret) : "SUCCESS",
>  		errno_name(t->exp_errno), t->exp_errno);
>  }

NACK.

As far as I can tell the io_submit() calls returns negative error
instead of setting errno, at least that's what libaio documentation
states.

> diff --git a/testcases/kernel/syscalls/io_submit/io_submit02.c b/testcases/kernel/syscalls/io_submit/io_submit02.c
> index 38b8555d8..6ba4d99a5 100644
> --- a/testcases/kernel/syscalls/io_submit/io_submit02.c
> +++ b/testcases/kernel/syscalls/io_submit/io_submit02.c
> @@ -79,7 +79,7 @@ static void run(unsigned int i)
>  	if (TST_RET == tc[i].nr)
>  		tst_res(TPASS, "io_submit() %s", tc[i].desc);
>  	else
> -		tst_res(TFAIL, "io_submit() returns %ld, expected %ld", TST_RET, tc[i].nr);
> +		tst_res(TFAIL | TTERRNO, "io_submit() returns %ld, expected %ld", TST_RET, tc[i].nr);

The best we can do here is to use tst_strerrno() to print the error as
we do in the io_submit().

>  	for (j = 0; j < TST_RET; j++) {
>  		tst_syscall(__NR_io_getevents, *tc[i].ctx, 1, 1, &evbuf,
> --
> 2.17.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* [LTP] [PATCH] syscalls/io_submit: Add TTERRNO/TERRNO when test fail
@ 2022-04-19  8:50 Zhao Gongyi via ltp
  2022-04-19 11:40 ` Cyril Hrubis
  0 siblings, 1 reply; 5+ messages in thread
From: Zhao Gongyi via ltp @ 2022-04-19  8:50 UTC (permalink / raw)
  To: ltp

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 testcases/kernel/syscalls/io_submit/io_submit01.c | 2 +-
 testcases/kernel/syscalls/io_submit/io_submit02.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c b/testcases/kernel/syscalls/io_submit/io_submit01.c
index db541fc01..ba75f6d81 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit01.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
@@ -130,7 +130,7 @@ static void verify_io_submit(unsigned int n)
 		return;
 	}

-	tst_res(TFAIL, "io_submit() returned %i(%s), expected %s(%i)",
+	tst_res(TFAIL | TERRNO, "io_submit() returned %i(%s), expected %s(%i)",
 		ret, ret < 0 ? tst_strerrno(-ret) : "SUCCESS",
 		errno_name(t->exp_errno), t->exp_errno);
 }
diff --git a/testcases/kernel/syscalls/io_submit/io_submit02.c b/testcases/kernel/syscalls/io_submit/io_submit02.c
index 38b8555d8..6ba4d99a5 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit02.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit02.c
@@ -79,7 +79,7 @@ static void run(unsigned int i)
 	if (TST_RET == tc[i].nr)
 		tst_res(TPASS, "io_submit() %s", tc[i].desc);
 	else
-		tst_res(TFAIL, "io_submit() returns %ld, expected %ld", TST_RET, tc[i].nr);
+		tst_res(TFAIL | TTERRNO, "io_submit() returns %ld, expected %ld", TST_RET, tc[i].nr);

 	for (j = 0; j < TST_RET; j++) {
 		tst_syscall(__NR_io_getevents, *tc[i].ctx, 1, 1, &evbuf,
--
2.17.1


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

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

end of thread, other threads:[~2022-04-21 12:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 12:05 [LTP] [PATCH] syscalls/io_submit: Add TTERRNO/TERRNO when test fail zhaogongyi via ltp
2022-04-19 13:14 ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2022-04-21 12:14 zhaogongyi via ltp
2022-04-19  8:50 Zhao Gongyi via ltp
2022-04-19 11:40 ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.