Message ID | 20230824154704.2598018-1-edliaw@google.com |
---|---|
State | Accepted |
Headers | show |
Series | epoll_pwait_var.h: check for syscall availability | expand |
Hi! Applied, thanks.
diff --git a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c index f4a55e008..05addf4b0 100644 --- a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c +++ b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c @@ -73,16 +73,10 @@ static void run(unsigned int n) tst_reap_children(); } -static void epoll_pwait_support(void) -{ - if (tst_variant == 0) - epoll_pwait_supported(); - else - epoll_pwait2_supported(); -} - static void setup(void) { + epoll_pwait_init(); + SAFE_SIGEMPTYSET(&signalset); SAFE_SIGADDSET(&signalset, SIGUSR1); @@ -91,9 +85,6 @@ static void setup(void) SAFE_SIGEMPTYSET(&sa.sa_mask); SAFE_SIGACTION(SIGUSR1, &sa, NULL); - epoll_pwait_info(); - epoll_pwait_support(); - SAFE_SOCKETPAIR(AF_UNIX, SOCK_STREAM, 0, sfd); efd = epoll_create(1); diff --git a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait02.c b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait02.c index 7914f1c50..1387eb6c9 100644 --- a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait02.c +++ b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait02.c @@ -32,7 +32,7 @@ static void run(void) static void setup(void) { - epoll_pwait_info(); + epoll_pwait_init(); SAFE_SOCKETPAIR(AF_UNIX, SOCK_STREAM, 0, sfd); diff --git a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait03.c b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait03.c index 2ad1a6abc..8b0f07ecc 100644 --- a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait03.c +++ b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait03.c @@ -40,7 +40,7 @@ int sample_fn(int clk_id, long long usec) static void setup(void) { - epoll_pwait_info(); + epoll_pwait_init(); SAFE_SOCKETPAIR(AF_UNIX, SOCK_STREAM, 0, sfd); diff --git a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c index 54b9be975..b9808375b 100644 --- a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c +++ b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c @@ -28,7 +28,7 @@ static void run(void) static void setup(void) { - epoll_pwait_info(); + epoll_pwait_init(); SAFE_SOCKETPAIR(AF_UNIX, SOCK_STREAM, 0, sfd); diff --git a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait05.c b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait05.c index 4c4aeb77d..d87646490 100644 --- a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait05.c +++ b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait05.c @@ -38,6 +38,8 @@ static void run_all(unsigned int n) static void setup(void) { + epoll_pwait2_supported(); + SAFE_SOCKETPAIR(AF_UNIX, SOCK_STREAM, 0, sfd); efd = epoll_create(1); diff --git a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait_var.h b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait_var.h index 60ee128c3..58a3f15a2 100644 --- a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait_var.h +++ b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait_var.h @@ -32,12 +32,15 @@ static int do_epoll_pwait(int epfd, struct epoll_event *events, int } -static void epoll_pwait_info(void) +static void epoll_pwait_init(void) { - if (tst_variant == 0) + if (tst_variant == 0) { tst_res(TINFO, "Test epoll_pwait()"); - else + epoll_pwait_supported(); + } else { tst_res(TINFO, "Test epoll_pwait2()"); + epoll_pwait2_supported(); + } } #endif /* LTP_EPOLL_PWAIT_VAR_H */
Check that epoll_pwait or epoll_pwait2 is available before running the corresponding test. Signed-off-by: Edward Liaw <edliaw@google.com> --- .../kernel/syscalls/epoll_pwait/epoll_pwait01.c | 13 ++----------- .../kernel/syscalls/epoll_pwait/epoll_pwait02.c | 2 +- .../kernel/syscalls/epoll_pwait/epoll_pwait03.c | 2 +- .../kernel/syscalls/epoll_pwait/epoll_pwait04.c | 2 +- .../kernel/syscalls/epoll_pwait/epoll_pwait05.c | 2 ++ .../kernel/syscalls/epoll_pwait/epoll_pwait_var.h | 9 ++++++--- 6 files changed, 13 insertions(+), 17 deletions(-)