From: Cyril Hrubis <chrubis@suse.cz>
To: Zhao Gongyi <zhaogongyi@huawei.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/epoll_create: Replace syscall to libc
Date: Fri, 29 Oct 2021 14:08:10 +0200 [thread overview]
Message-ID: <YXvkKoM1VBsihn+y@yuki> (raw)
In-Reply-To: <20211028031422.208689-1-zhaogongyi@huawei.com>
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
next prev parent reply other threads:[~2021-10-29 12:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-11-05 2:10 zhaogongyi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YXvkKoM1VBsihn+y@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=zhaogongyi@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.