[PATCH 6/6] tests/pidfd_getfd-y*: skip when no /proc

Alyssa Ross hi at alyssa.is
Tue May 4 19:40:58 UTC 2021


---
 tests/pidfd_getfd-y.c  | 2 ++
 tests/pidfd_getfd-yy.c | 2 ++
 tests/pidfd_getfd.c    | 5 +++++
 3 files changed, 9 insertions(+)

diff --git a/tests/pidfd_getfd-y.c b/tests/pidfd_getfd-y.c
index 7e786555..0aff5792 100644
--- a/tests/pidfd_getfd-y.c
+++ b/tests/pidfd_getfd-y.c
@@ -1,3 +1,5 @@
 #define PIDFD_PATH "<anon_inode:[pidfd]>"
 #define FD0_PATH "</dev/full>"
+#define SKIP_IF_PROC_IS_UNAVAILABLE skip_if_unavailable("/proc/self/fd/")
+
 #include "pidfd_getfd.c"
diff --git a/tests/pidfd_getfd-yy.c b/tests/pidfd_getfd-yy.c
index 9a5a1856..9f28b8ac 100644
--- a/tests/pidfd_getfd-yy.c
+++ b/tests/pidfd_getfd-yy.c
@@ -1,3 +1,5 @@
 #define PRINT_PIDFD 1
 #define FD0_PATH "</dev/full<char 1:7>>"
+#define SKIP_IF_PROC_IS_UNAVAILABLE skip_if_unavailable("/proc/self/fd/")
+
 #include "pidfd_getfd.c"
diff --git a/tests/pidfd_getfd.c b/tests/pidfd_getfd.c
index 85feb127..f6e71aec 100644
--- a/tests/pidfd_getfd.c
+++ b/tests/pidfd_getfd.c
@@ -27,6 +27,9 @@
 #ifndef PRINT_PIDFD
 # define PRINT_PIDFD 0
 #endif
+#ifndef SKIP_IF_PROC_IS_UNAVAILABLE
+# define SKIP_IF_PROC_IS_UNAVAILABLE
+#endif
 
 static const char *errstr;
 
@@ -48,6 +51,8 @@ k_pidfd_getfd(const unsigned int pidfd, const unsigned int fd,
 int
 main(void)
 {
+	SKIP_IF_PROC_IS_UNAVAILABLE;
+
 	long rc;
 
 	rc = k_pidfd_getfd(-1U, -1U, 0);
-- 
2.31.0



More information about the Strace-devel mailing list