Skip to contentSkip to conversation

epoll_pwait: Add test variants for epoll_pwait2 in epoll_pwait01

PATCH New Xie Ziyao 2 participants 4 messages Jul 28, 2021

lore
Share & tools
lore

Xie Ziyao

author
#0 lore raw

v2 cover epoll_pwait: Add test variants for epoll_pwait2 in epoll_pwait01

v1->v2:
1. Remove testcases/kernel/syscalls/epoll_pwait/epoll_pwait.h.
2. Switch tst_process_state_wait2() to TST_PROCESS_STATE_WAIT().

Xie Ziyao (2):
lapi: Add epoll_pwait_supported() and epoll_pwait2_supported() check
epoll_pwait: Add test variants for epoll_pwait2 in epoll_pwait01

 include/lapi/epoll.h                          |  22 +-
 .../kernel/syscalls/epoll_pwait/epoll_pwait.h |  36 ---
 .../syscalls/epoll_pwait/epoll_pwait01.c      | 233 ++++++------------
 3 files changed, 98 insertions(+), 193 deletions(-)
 delete mode 100644 testcases/kernel/syscalls/epoll_pwait/epoll_pwait.h

--
2.17.1

author
#1 lore raw

PATCH v2 1/2 lapi: Add epoll_pwait_supported() and epoll_pwait2_supported() check

Add the function of checking whether epoll_pwait or epoll_pwait2 is supported.

---
 include/lapi/epoll.h | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
include/lapi/epoll.h +18 -4
index e5b4387f1..fc068ae20 100644
@@ -14,18 +14,32 @@
 #define EPOLL_CLOEXEC 02000000
 #endif
 
+static inline void epoll_pwait_supported(void)
+{
+	/* allow the tests to fail early */
+	tst_syscall(__NR_epoll_pwait);
+}
+
 #ifndef HAVE_EPOLL_PWAIT
-int epoll_pwait(int epfd, struct epoll_event *events, int maxevents,
-		int timeout, const sigset_t *sigmask)
+static inline int epoll_pwait(int epfd, struct epoll_event *events,
+			      int maxevents, int timeout,
+			      const sigset_t *sigmask)
 {
 	return tst_syscall(__NR_epoll_pwait, epfd, events, maxevents,
 			   timeout, sigmask, _NSIG / 8);
 }
 #endif
 
+static inline void epoll_pwait2_supported(void)
+{
+	/* allow the tests to fail early */
+	tst_syscall(__NR_epoll_pwait2);
+}
+
 #ifndef HAVE_EPOLL_PWAIT2
-int epoll_pwait2(int epfd, struct epoll_event *events, int maxevents,
-		 const struct timespec *timeout, const sigset_t *sigmask)
+static inline int epoll_pwait2(int epfd, struct epoll_event *events,
+			       int maxevents, const struct timespec *timeout,
+			       const sigset_t *sigmask)
 {
 	if (timeout == NULL)
 		return tst_syscall(__NR_epoll_pwait2, epfd, events, maxevents,

--
2.17.1

author
#2 lore raw

PATCH v2 2/2 epoll_pwait: Add test variants for epoll_pwait2 in epoll_pwait01

In reply to Xie Ziyao

Add test variants to switch between epoll_pwait and epoll_pwait2.

---
v1->v2:
1. Remove testcases/kernel/syscalls/epoll_pwait/epoll_pwait.h.
2. Switch tst_process_state_wait2() to TST_PROCESS_STATE_WAIT().

 .../kernel/syscalls/epoll_pwait/epoll_pwait.h |  36 ---
 .../syscalls/epoll_pwait/epoll_pwait01.c      | 233 ++++++------------
 2 files changed, 80 insertions(+), 189 deletions(-)
 delete mode 100644 testcases/kernel/syscalls/epoll_pwait/epoll_pwait.h
testcases/kernel/syscalls/epoll_pwait/epoll_pwait.h deleted +0 -36
deleted file mode 100644
index 344ff2072..000000000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2016 Fujitsu Ltd.
- * Author: Guangwen Feng <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.
- */
-
-#ifndef EPOLL_PWAIT_H
-#define EPOLL_PWAIT_H
-
-#include <sys/types.h>
-#include <signal.h>
-#include "config.h"
-#include "lapi/syscalls.h"
-
-#if !defined(HAVE_EPOLL_PWAIT)
-int epoll_pwait(int epfd, struct epoll_event *events, int maxevents,
-	int timeout, const sigset_t *sigmask)
-{
-	return ltp_syscall(__NR_epoll_pwait, epfd, events, maxevents,
-		timeout, sigmask, _NSIG / 8);
-}
-#endif
-
-#endif /* EPOLL_PWAIT_H */
testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c +80 -153

282 lines not on this page · raw message

--
2.17.1

#3 lore raw

PATCH v2 2/2 epoll_pwait: Add test variants for epoll_pwait2 in epoll_pwait01

Hi!
Pushed with minor changes, thanks.

* Move the check_epoll_support() to the setup to abort the test early if syscall is not supported

* Revoved the .min_kver since we check for the syscall availability now

* Reformatted the description a bit so that it renders nicely in metadata

Signature · 2 lines
Cyril Hrubis
[email protected]