All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/epoll_create: Replace syscall to libc
@ 2021-10-28  3:14 Zhao Gongyi
  2021-10-29  7:49 ` Jan Stancek
  2021-10-29 12:08 ` Cyril Hrubis
  0 siblings, 2 replies; 4+ messages in thread
From: Zhao Gongyi @ 2021-10-28  3:14 UTC (permalink / raw)
  To: ltp

For epoll_create01.c/epoll_create02.c, we should replace syscall to libc
or the testcase will fail because of Syscall epoll_create is not support
in some arches.

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

diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
index 3ef5b5cac..b6ebe9ad7 100644
--- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
+++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
@@ -24,7 +24,7 @@ static int tc[] = {1, INT_MAX};

 static void run(unsigned int n)
 {
-	TST_EXP_FD(tst_syscall(__NR_epoll_create, tc[n]), "epoll_create(%d)", tc[n]);
+	TST_EXP_FD(epoll_create(tc[n]), "epoll_create(%d)", tc[n]);

 	if (!TST_PASS)
 		return;
diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create02.c b/testcases/kernel/syscalls/epoll_create/epoll_create02.c
index c59ea7944..e96228983 100644
--- a/testcases/kernel/syscalls/epoll_create/epoll_create02.c
+++ b/testcases/kernel/syscalls/epoll_create/epoll_create02.c
@@ -27,7 +27,7 @@ static struct test_case_t {

 static void run(unsigned int n)
 {
-	TST_EXP_FAIL(tst_syscall(__NR_epoll_create, tc[n].size),
+	TST_EXP_FAIL(epoll_create(tc[n].size),
 		     tc[n].exp_err, "create(%d)", tc[n].size);
 }

--
2.17.1


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] syscalls/epoll_create: Replace syscall to libc
@ 2021-11-05  2:10 zhaogongyi
  0 siblings, 0 replies; 4+ messages in thread
From: zhaogongyi @ 2021-11-05  2:10 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

It looks good for me and I have resubmit the patch, please see: https://patchwork.ozlabs.org/project/ltp/patch/20211105020729.162391-1-zhaogongyi@huawei.com/

Thanks so much!

Best Regards,
Gongyi

> Hi!
> > For epoll_create01.c/epoll_create02.c, we should replace syscall to
> > libc or the testcase will fail because of Syscall epoll_create is not
> > support in some arches.
> 
> I guess that epoll_create() is emulated via epoll_create1() in these cases
> right?
> 
> Does these testcases fail in these cases though? The __NR_epoll_create
> should be set to -1 when the syscall is not supported and the test should
> be skipped with TCONF.
> 
> The patch looks good, however it would be slightly better to add test
> variants so that we call both the raw syscall, if available, and the glibc
> wrapper, with something as:
> 
> 
> static int do_epoll_create(int size)
> {
> 	switch (tst_variant) {
> 	case 0:
> 		return tst_syscall(__NR_epoll_create, size);
> 	break;
> 	case 1:
> 		return epoll_create(size);
> 	break;
> }
> 
> static void run(unsigned int n)
> {
> 	TST_EXP_FD(do_epoll_create(tc[n]) ...);
> 
> 	...
> }
> 
> static void setup(void)
> {
> 	switch (tst_variant) {
> 	case 0:
> 		tst_res(TINFO, "Testing variant: syscall __NR_epoll_create");
> 	break;
> 	case 1:
> 		tst_res(TINFO, "Testing variant: libc epoll_create()");
> 	break;
> 	}
> }
> 
> static struct tst_test test = {
> 	...
> 	.test_variants = 2,
> 	...
> };
> 
> 
> > Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> > ---
> >  testcases/kernel/syscalls/epoll_create/epoll_create01.c | 2 +-
> > testcases/kernel/syscalls/epoll_create/epoll_create02.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> > b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> > index 3ef5b5cac..b6ebe9ad7 100644
> > --- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> > +++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> > @@ -24,7 +24,7 @@ static int tc[] = {1, INT_MAX};
> >
> >  static void run(unsigned int n)
> >  {
> > -	TST_EXP_FD(tst_syscall(__NR_epoll_create, tc[n]), "epoll_create(%d)",
> tc[n]);
> > +	TST_EXP_FD(epoll_create(tc[n]), "epoll_create(%d)", tc[n]);
> >
> >  	if (!TST_PASS)
> >  		return;
> > diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create02.c
> > b/testcases/kernel/syscalls/epoll_create/epoll_create02.c
> > index c59ea7944..e96228983 100644
> > --- a/testcases/kernel/syscalls/epoll_create/epoll_create02.c
> > +++ b/testcases/kernel/syscalls/epoll_create/epoll_create02.c
> > @@ -27,7 +27,7 @@ static struct test_case_t {
> >
> >  static void run(unsigned int n)
> >  {
> > -	TST_EXP_FAIL(tst_syscall(__NR_epoll_create, tc[n].size),
> > +	TST_EXP_FAIL(epoll_create(tc[n].size),
> >  		     tc[n].exp_err, "create(%d)", tc[n].size);  }
> >
> > --
> > 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] 4+ messages in thread

end of thread, other threads:[~2021-11-05  2:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28  3:14 [LTP] [PATCH] syscalls/epoll_create: Replace syscall to libc Zhao Gongyi
2021-10-29  7:49 ` Jan Stancek
2021-10-29 12:08 ` Cyril Hrubis
2021-11-05  2:10 zhaogongyi

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.