[PATCH 4/6] tests/kcmp-y: skip when no /proc

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


---
 tests/kcmp-y.c | 1 +
 tests/kcmp.c   | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/tests/kcmp-y.c b/tests/kcmp-y.c
index 02ad90e5..b1d6bf93 100644
--- a/tests/kcmp-y.c
+++ b/tests/kcmp-y.c
@@ -1,3 +1,4 @@
 #define VERBOSE_FD 1
+#define SKIP_IF_PROC_IS_UNAVAILABLE skip_if_unavailable("/proc/self/fd/")
 
 #include "kcmp.c"
diff --git a/tests/kcmp.c b/tests/kcmp.c
index 36232943..ad32a871 100644
--- a/tests/kcmp.c
+++ b/tests/kcmp.c
@@ -22,6 +22,10 @@
 # include <unistd.h>
 # include <linux/kcmp.h>
 
+# ifndef SKIP_IF_PROC_IS_UNAVAILABLE
+#  define SKIP_IF_PROC_IS_UNAVAILABLE
+# endif
+
 # ifndef VERBOSE_FD
 #  define VERBOSE_FD 0
 # endif
@@ -123,6 +127,7 @@ do_kcmp(kernel_ulong_t pid1, kernel_ulong_t pid2, kernel_ulong_t type,
 int
 main(void)
 {
+	SKIP_IF_PROC_IS_UNAVAILABLE;
 	PIDNS_TEST_INIT;
 
 	static const kernel_ulong_t bogus_pid1 =
-- 
2.31.0



More information about the Strace-devel mailing list