* [LTP] [PATCH v2] syscalls/epoll_create: add libc test for epoll_create
@ 2021-11-05 2:07 Zhao Gongyi
2021-11-05 7:56 ` Petr Vorel
2021-11-05 11:54 ` Cyril Hrubis
0 siblings, 2 replies; 3+ messages in thread
From: Zhao Gongyi @ 2021-11-05 2:07 UTC (permalink / raw)
To: ltp
For epoll_create01.c/epoll_create02.c, we add libc epoll_create()
test because Syscall __NR_epoll_create is not support in some arches.
Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
v1->v2: remain syscall test
.../syscalls/epoll_create/epoll_create01.c | 30 ++++++++++++++++--
.../syscalls/epoll_create/epoll_create02.c | 31 +++++++++++++++++--
2 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
index 3ef5b5cac..5b9b48e73 100644
--- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
+++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
@@ -15,23 +15,49 @@
*/
#include <sys/epoll.h>
-
#include "tst_test.h"
#include "lapi/epoll.h"
#include "lapi/syscalls.h"
static int tc[] = {1, INT_MAX};
+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(tst_syscall(__NR_epoll_create, tc[n]), "epoll_create(%d)", tc[n]);
+ TST_EXP_FD(do_epoll_create(tc[n]), "epoll_create(%d)", tc[n]);
if (!TST_PASS)
return;
SAFE_CLOSE(TST_RET);
}
+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,
.tcnt = ARRAY_SIZE(tc),
+ .setup = setup,
.test = run,
};
diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create02.c b/testcases/kernel/syscalls/epoll_create/epoll_create02.c
index c59ea7944..f19d58882 100644
--- a/testcases/kernel/syscalls/epoll_create/epoll_create02.c
+++ b/testcases/kernel/syscalls/epoll_create/epoll_create02.c
@@ -25,13 +25,40 @@ static struct test_case_t {
{-1, EINVAL}
};
+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_FAIL(tst_syscall(__NR_epoll_create, tc[n].size),
- tc[n].exp_err, "create(%d)", tc[n].size);
+ TST_EXP_FAIL(do_epoll_create(tc[n].size),
+ tc[n].exp_err, "epoll_create(%d)", tc[n].size);
}
+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,
.tcnt = ARRAY_SIZE(tc),
+ .setup = setup,
.test = run,
};
--
2.17.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v2] syscalls/epoll_create: add libc test for epoll_create
2021-11-05 2:07 [LTP] [PATCH v2] syscalls/epoll_create: add libc test for epoll_create Zhao Gongyi
@ 2021-11-05 7:56 ` Petr Vorel
2021-11-05 11:54 ` Cyril Hrubis
1 sibling, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2021-11-05 7:56 UTC (permalink / raw)
To: Zhao Gongyi; +Cc: ltp
Hi Zhao,
> For epoll_create01.c/epoll_create02.c, we add libc epoll_create()
> test because Syscall __NR_epoll_create is not support in some arches.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
FYI in the past I was thinking about further automation of test variant,
thus I added variant_desc (see accept4_01.c). But nowadays most of the test
variants are using struct test_variants (mostly due time64 support thus they use
time64_variants.h). It looks to me only accept4_01.c and epoll_create0[12].c you
just ported, so any optimisation for non-time64 tests is not relevant any more.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v2] syscalls/epoll_create: add libc test for epoll_create
2021-11-05 2:07 [LTP] [PATCH v2] syscalls/epoll_create: add libc test for epoll_create Zhao Gongyi
2021-11-05 7:56 ` Petr Vorel
@ 2021-11-05 11:54 ` Cyril Hrubis
1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2021-11-05 11:54 UTC (permalink / raw)
To: Zhao Gongyi; +Cc: ltp
Hi!
I've moved the variants code to a header, so that it does not need to be
repeated in each test and pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-05 11:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 2:07 [LTP] [PATCH v2] syscalls/epoll_create: add libc test for epoll_create Zhao Gongyi
2021-11-05 7:56 ` Petr Vorel
2021-11-05 11:54 ` 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.