summary refs log tree commit diff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/syscalls.scm')
-rw-r--r--tests/syscalls.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 86783b96c4..a57a9ca9f9 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -20,6 +20,7 @@
 (define-module (test-syscalls)
   #:use-module (guix utils)
   #:use-module (guix build syscalls)
+  #:use-module (gnu build linux-container)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-64)
@@ -80,7 +81,11 @@
 (define (user-namespace pid)
   (string-append "/proc/" (number->string pid) "/ns/user"))
 
-(unless (file-exists? (user-namespace (getpid)))
+(define perform-container-tests?
+  (and (user-namespace-supported?)
+       (unprivileged-user-namespace-supported?)))
+
+(unless perform-container-tests?
   (test-skip 1))
 (test-assert "clone"
   (match (clone (logior CLONE_NEWUSER SIGCHLD))
@@ -93,7 +98,7 @@
             ((_ . status)
              (= 42 (status:exit-val status))))))))
 
-(unless (file-exists? (user-namespace (getpid)))
+(unless perform-container-tests?
   (test-skip 1))
 (test-assert "setns"
   (match (clone (logior CLONE_NEWUSER SIGCHLD))
@@ -122,7 +127,7 @@
              (waitpid fork-pid)
              result))))))))
 
-(unless (file-exists? (user-namespace (getpid)))
+(unless perform-container-tests?
   (test-skip 1))
 (test-assert "pivot-root"
   (match (pipe)