[CRIU] [PATCH] test: Skip seccomp tests on old libc/kernel

Cyrill Gorcunov gorcunov at openvz.org
Fri Feb 19 09:02:30 PST 2016


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/zdtm/live/static/seccomp_filter_tsync.c | 17 +++++++++++++++++
 test/zdtm/live/static/seccomp_strict.c       | 18 ++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/test/zdtm/live/static/seccomp_filter_tsync.c b/test/zdtm/live/static/seccomp_filter_tsync.c
index a5835498f80e..e1240960aebe 100644
--- a/test/zdtm/live/static/seccomp_filter_tsync.c
+++ b/test/zdtm/live/static/seccomp_filter_tsync.c
@@ -26,6 +26,8 @@
 const char *test_doc	= "Check that SECCOMP_FILTER_FLAG_TSYNC works correctly after restore";
 const char *test_author	= "Tycho Andersen <tycho.andersen at canonical.com>";
 
+#ifdef __NR_seccomp
+
 pthread_mutex_t getpid_wait;
 
 int get_seccomp_mode(pid_t pid)
@@ -200,3 +202,18 @@ err:
 	kill(pid, SIGKILL);
 	return 1;
 }
+
+#else /* __NR_seccomp */
+int main(int argc, char ** argv)
+{
+	test_init(argc, argv);
+
+	skip("Old libc or kernel headers detected");
+
+	test_daemon();
+	test_waitsig();
+
+	pass();
+	return 0;
+}
+#endif /* __NR_seccomp */
diff --git a/test/zdtm/live/static/seccomp_strict.c b/test/zdtm/live/static/seccomp_strict.c
index 8b1a37ac5d3f..75f9ee6063c4 100644
--- a/test/zdtm/live/static/seccomp_strict.c
+++ b/test/zdtm/live/static/seccomp_strict.c
@@ -14,6 +14,8 @@
 const char *test_doc	= "Check that SECCOMP_MODE_STRICT is restored";
 const char *test_author	= "Tycho Andersen <tycho.andersen at canonical.com>";
 
+#ifdef __NR_seccomp
+
 int get_seccomp_mode(pid_t pid)
 {
 	FILE *f;
@@ -120,3 +122,19 @@ err:
 	kill(pid, SIGKILL);
 	return 1;
 }
+
+#else /* __NR_seccomp */
+
+int main(int argc, char ** argv)
+{
+	test_init(argc, argv);
+
+	skip("Old libc or kernel headers detected");
+
+	test_daemon();
+	test_waitsig();
+
+	pass();
+	return 0;
+}
+#endif /* __NR_seccomp */
-- 
2.5.0



More information about the CRIU mailing list