[LTP] [PATCH] syscalls/epoll_create: Replace syscall to libc
zhaogongyi
zhaogongyi@huawei.com
Fri Nov 5 03:10:30 CET 2021
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
More information about the ltp
mailing list