public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/shmctl: Using TERRNO to macth errno
@ 2021-03-29  2:44 zhaogongyi
  2021-03-29  3:00 ` xuyang2018.jy
  0 siblings, 1 reply; 10+ messages in thread
From: zhaogongyi @ 2021-03-29  2:44 UTC (permalink / raw)
  To: ltp

Hi Xu, Li,

On the other hand, we have created a shm in setup, why we query with SHM_INFO and return 0?

Best Regards,
Gongyi

> Hi Gongyi
> 
> The SHM_STAT_ANY cmd was introduced since kernel 4.17. I guess we
> should add check for it.
> > Hi Li,
> >
> > Yes, I find the problem in my testing of qemu with kernel version 4.4
> > and the config is vexpress_defconfig.
> >
> > Specifically as follow:
> >
> > tst_test.c:1294: TINFO: Timeout per run is 0h 05m 00s
> >
> > shmctl04.c:119: TINFO: Test SHM_STAT_ANY with nobody user
> >
> > TST_RET: 0 SHM_STAT_ANY: 15
> >
> > shmctl04.c:134: TFAIL: SHM_INFO haven't returned a valid index: EINVAL
> > (22)
> >
> > shmctl04.c:150: TFAIL: Counted used = 0, used_ids = 1
> >
> > shmctl04.c:85: TPASS: used_ids = 1
> >
> > shmctl04.c:92: TPASS: shm_rss = 0
> >
> > shmctl04.c:99: TPASS: shm_swp = 0
> >
> > shmctl04.c:106: TPASS: shm_tot = 1
> >
> > shmctl04.c:119: TINFO: Test SHM_STAT_ANY with root user
> >
> > TST_RET: 0 SHM_STAT_ANY: 15
> >
> > shmctl04.c:134: TFAIL: SHM_INFO haven't returned a valid index: EINVAL
> > (22)
> >
> > shmctl04.c:150: TFAIL: Counted used = 0, used_ids = 1
> >
> > shmctl04.c:85: TPASS: used_ids = 1
> >
> > shmctl04.c:92: TPASS: shm_rss = 0
> >
> > shmctl04.c:99: TPASS: shm_swp = 0
> >
> > shmctl04.c:106: TPASS: shm_tot = 1
> >
> > Summary:
> >
> > passed   8
> >
> > failed   4
> >
> > broken   0
> >
> > skipped  0
> >
> > warnings 0
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [LTP] [PATCH] syscalls/shmctl: Using TERRNO to macth errno
@ 2021-03-29 13:55 zhaogongyi
  0 siblings, 0 replies; 10+ messages in thread
From: zhaogongyi @ 2021-03-29 13:55 UTC (permalink / raw)
  To: ltp

Hi Xu, Li,

I have checked the shmctl's failure whose root cause is that SHM_STAT_ANY not supported in v4.4,

so I have submit a patch to fix it.

Thanks!

Best Regards,
Gongyi


> 
> Hi Gongyi
> 
> > Hi Xu, Li,
> >
> > On the other hand, we have created a shm in setup, why we query with
> SHM_INFO and return 0?
> Because SHM_INFO ignores shm_id parameter like IPC_INFO in kernel. We
> created a shm in setup just to make sure that there is at least one during
> the testrun.
> 
> >
> > Best Regards,
> > Gongyi
> >
> >> Hi Gongyi
> >>
> >> The SHM_STAT_ANY cmd was introduced since kernel 4.17. I guess we
> >> should add check for it.
> >>> Hi Li,
> >>>
> >>> Yes, I find the problem in my testing of qemu with kernel version 4.4
> >>> and the config is vexpress_defconfig.
> >>>
> >>> Specifically as follow:
> >>>
> >>> tst_test.c:1294: TINFO: Timeout per run is 0h 05m 00s
> >>>
> >>> shmctl04.c:119: TINFO: Test SHM_STAT_ANY with nobody user
> >>>
> >>> TST_RET: 0 SHM_STAT_ANY: 15
> >>>
> >>> shmctl04.c:134: TFAIL: SHM_INFO haven't returned a valid index:
> EINVAL
> >>> (22)
> >>>
> >>> shmctl04.c:150: TFAIL: Counted used = 0, used_ids = 1
> >>>
> >>> shmctl04.c:85: TPASS: used_ids = 1
> >>>
> >>> shmctl04.c:92: TPASS: shm_rss = 0
> >>>
> >>> shmctl04.c:99: TPASS: shm_swp = 0
> >>>
> >>> shmctl04.c:106: TPASS: shm_tot = 1
> >>>
> >>> shmctl04.c:119: TINFO: Test SHM_STAT_ANY with root user
> >>>
> >>> TST_RET: 0 SHM_STAT_ANY: 15
> >>>
> >>> shmctl04.c:134: TFAIL: SHM_INFO haven't returned a valid index:
> EINVAL
> >>> (22)
> >>>
> >>> shmctl04.c:150: TFAIL: Counted used = 0, used_ids = 1
> >>>
> >>> shmctl04.c:85: TPASS: used_ids = 1
> >>>
> >>> shmctl04.c:92: TPASS: shm_rss = 0
> >>>
> >>> shmctl04.c:99: TPASS: shm_swp = 0
> >>>
> >>> shmctl04.c:106: TPASS: shm_tot = 1
> >>>
> >>> Summary:
> >>>
> >>> passed   8
> >>>
> >>> failed   4
> >>>
> >>> broken   0
> >>>
> >>> skipped  0
> >>>
> >>> warnings 0
> >>>

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [LTP] [PATCH] syscalls/shmctl: Using TERRNO to macth errno
@ 2021-03-29  3:05 zhaogongyi
  0 siblings, 0 replies; 10+ messages in thread
From: zhaogongyi @ 2021-03-29  3:05 UTC (permalink / raw)
  To: ltp

Hi,

why does it return 0 in " TEST(shmctl(0, SHM_INFO, (struct shmid_ds *)&info))"?

I see TST_RET is equal 0 in "shmctl(TST_RET, SHM_STAT_ANY, &ds)".

Best Regards,
Gongyi


> Hi Gongyi
> 
> > Hi Xu, Li,
> >
> > On the other hand, we have created a shm in setup, why we query with
> SHM_INFO and return 0?
> Because SHM_INFO ignores shm_id parameter like IPC_INFO in kernel. We
> created a shm in setup just to make sure that there is at least one during
> the testrun.
> 
> >
> > Best Regards,
> > Gongyi
> >
> >> Hi Gongyi
> >>
> >> The SHM_STAT_ANY cmd was introduced since kernel 4.17. I guess we
> >> should add check for it.
> >>> Hi Li,
> >>>
> >>> Yes, I find the problem in my testing of qemu with kernel version 4.4
> >>> and the config is vexpress_defconfig.
> >>>
> >>> Specifically as follow:
> >>>
> >>> tst_test.c:1294: TINFO: Timeout per run is 0h 05m 00s
> >>>
> >>> shmctl04.c:119: TINFO: Test SHM_STAT_ANY with nobody user
> >>>
> >>> TST_RET: 0 SHM_STAT_ANY: 15
> >>>
> >>> shmctl04.c:134: TFAIL: SHM_INFO haven't returned a valid index:
> EINVAL
> >>> (22)
> >>>
> >>> shmctl04.c:150: TFAIL: Counted used = 0, used_ids = 1
> >>>
> >>> shmctl04.c:85: TPASS: used_ids = 1
> >>>
> >>> shmctl04.c:92: TPASS: shm_rss = 0
> >>>
> >>> shmctl04.c:99: TPASS: shm_swp = 0
> >>>
> >>> shmctl04.c:106: TPASS: shm_tot = 1
> >>>
> >>> shmctl04.c:119: TINFO: Test SHM_STAT_ANY with root user
> >>>
> >>> TST_RET: 0 SHM_STAT_ANY: 15
> >>>
> >>> shmctl04.c:134: TFAIL: SHM_INFO haven't returned a valid index:
> EINVAL
> >>> (22)
> >>>
> >>> shmctl04.c:150: TFAIL: Counted used = 0, used_ids = 1
> >>>
> >>> shmctl04.c:85: TPASS: used_ids = 1
> >>>
> >>> shmctl04.c:92: TPASS: shm_rss = 0
> >>>
> >>> shmctl04.c:99: TPASS: shm_swp = 0
> >>>
> >>> shmctl04.c:106: TPASS: shm_tot = 1
> >>>
> >>> Summary:
> >>>
> >>> passed   8
> >>>
> >>> failed   4
> >>>
> >>> broken   0
> >>>
> >>> skipped  0
> >>>
> >>> warnings 0
> >>>

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [LTP] [PATCH] syscalls/shmctl: Using TERRNO to macth errno
@ 2021-03-29  2:22 zhaogongyi
  2021-03-29  2:31 ` xuyang2018.jy
  0 siblings, 1 reply; 10+ messages in thread
From: zhaogongyi @ 2021-03-29  2:22 UTC (permalink / raw)
  To: ltp

Hi Li,

Yes, I find the problem in my testing of qemu with kernel version 4.4 and the config is vexpress_defconfig.
Specifically as follow:

tst_test.c:1294: TINFO: Timeout per run is 0h 05m 00s
shmctl04.c:119: TINFO: Test SHM_STAT_ANY with nobody user
TST_RET: 0 SHM_STAT_ANY: 15
shmctl04.c:134: TFAIL: SHM_INFO haven't returned a valid index: EINVAL (22)
shmctl04.c:150: TFAIL: Counted used = 0, used_ids = 1
shmctl04.c:85: TPASS: used_ids = 1
shmctl04.c:92: TPASS: shm_rss = 0
shmctl04.c:99: TPASS: shm_swp = 0
shmctl04.c:106: TPASS: shm_tot = 1
shmctl04.c:119: TINFO: Test SHM_STAT_ANY with root user
TST_RET: 0 SHM_STAT_ANY: 15
shmctl04.c:134: TFAIL: SHM_INFO haven't returned a valid index: EINVAL (22)
shmctl04.c:150: TFAIL: Counted used = 0, used_ids = 1
shmctl04.c:85: TPASS: used_ids = 1
shmctl04.c:92: TPASS: shm_rss = 0
shmctl04.c:99: TPASS: shm_swp = 0
shmctl04.c:106: TPASS: shm_tot = 1

Summary:
passed   8
failed   4
broken   0
skipped  0
warnings 0


I will analysis the root cause of fail later.

Thanks!

Best Regards,
Gongyi


???: Li Wang [mailto:liwang@redhat.com]
????: 2021?3?29? 10:10
???: zhaogongyi <zhaogongyi@huawei.com>
??: LTP List <ltp@lists.linux.it>
??: Re: [LTP] [PATCH] syscalls/shmctl: Using TERRNO to macth errno



On Mon, Mar 29, 2021 at 9:56 AM zhaogongyi <zhaogongyi@huawei.com<mailto:zhaogongyi@huawei.com>> wrote:
Hi Li,

Actually, I have no effective tools to find out all of this type problems.

Indeed, the wrong usage of TTERRNO you find mostly occurred in bad code logic.
That's hard to correct them in an automatic way.

--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210329/cea3a9a1/attachment-0001.htm>

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [LTP] [PATCH] syscalls/shmctl: Using TERRNO to macth errno
@ 2021-03-29  1:56 zhaogongyi
  2021-03-29  2:09 ` Li Wang
  0 siblings, 1 reply; 10+ messages in thread
From: zhaogongyi @ 2021-03-29  1:56 UTC (permalink / raw)
  To: ltp

Hi Li,

Actually, I have no effective tools to find out all of this type problems.

Thanks for your review!

Best Regards,
Gongyi



Hi Gongyi,

On Sat, Mar 27, 2021 at 6:24 PM Zhao Gongyi <zhaogongyi@huawei.com<mailto:zhaogongyi@huawei.com>> wrote:
When "shmid == -1", we need print the errno with TERRNO. It must have no error in
TEST, otherwise it has return early.

Right, but it is mostly caused by copy&past.

And, I guess you are working on fix the TERRNO/TTERRNO issues currently,
so it would be great to combine them together in one patch, other than sending
it one by one separately.

Anyway, I help push this. Thanks!

--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210329/48eecfeb/attachment.htm>

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [LTP] [PATCH] syscalls/shmctl: Using TERRNO to macth errno
@ 2021-03-27 10:23 Zhao Gongyi
  2021-03-29  1:49 ` Li Wang
  0 siblings, 1 reply; 10+ messages in thread
From: Zhao Gongyi @ 2021-03-27 10:23 UTC (permalink / raw)
  To: ltp

When "shmid == -1", we need print the errno with TERRNO. It must have no error in
TEST, otherwise it has return early.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 testcases/kernel/syscalls/ipc/shmctl/shmctl04.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
index c70a76fb2..9e8ec4199 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
@@ -130,7 +130,7 @@ static void verify_shminfo(unsigned int n)
 	shmid = shmctl(TST_RET, SHM_STAT_ANY, &ds);

 	if (shmid == -1) {
-		tst_res(TFAIL | TTERRNO, "SHM_INFO haven't returned a valid index");
+		tst_res(TFAIL | TERRNO, "SHM_INFO haven't returned a valid index");
 	} else {
 		tst_res(TPASS,
 			"SHM_INFO returned valid index %li maps to shmid %i",
--
2.17.1


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

end of thread, other threads:[~2021-03-29 13:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-29  2:44 [LTP] [PATCH] syscalls/shmctl: Using TERRNO to macth errno zhaogongyi
2021-03-29  3:00 ` xuyang2018.jy
  -- strict thread matches above, loose matches on Subject: below --
2021-03-29 13:55 zhaogongyi
2021-03-29  3:05 zhaogongyi
2021-03-29  2:22 zhaogongyi
2021-03-29  2:31 ` xuyang2018.jy
2021-03-29  1:56 zhaogongyi
2021-03-29  2:09 ` Li Wang
2021-03-27 10:23 Zhao Gongyi
2021-03-29  1:49 ` Li Wang

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