summaryrefslogtreecommitdiff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-11-03 08:32:53 -0500
committerDavid Thompson <dthompson2@worcester.edu>2015-11-03 11:41:04 -0500
commitb7d48312bbfc7bdbb3895eb10edc352eeb555b98 (patch)
tree90b3b401a88358aee843fb25d7fff293946d2a02 /tests/syscalls.scm
parent9ff7827a21c13e67fb72196da10ab1ad30d79ddf (diff)
build: container: Add feature test predicates.
* gnu/build/linux-container.scm (user-namespace-supported?, unprivileged-user-namespace-supported?, setgroups-supported?): New procedures. * tests/container.scm: Use predicates. * tests/syscalls.scm: Likewise.
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 86783b96c4b..a57a9ca9f9d 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -20,6 +20,7 @@
20(define-module (test-syscalls) 20(define-module (test-syscalls)
21 #:use-module (guix utils) 21 #:use-module (guix utils)
22 #:use-module (guix build syscalls) 22 #:use-module (guix build syscalls)
23 #:use-module (gnu build linux-container)
23 #:use-module (srfi srfi-1) 24 #:use-module (srfi srfi-1)
24 #:use-module (srfi srfi-26) 25 #:use-module (srfi srfi-26)
25 #:use-module (srfi srfi-64) 26 #:use-module (srfi srfi-64)
@@ -80,7 +81,11 @@
80(define (user-namespace pid) 81(define (user-namespace pid)
81 (string-append "/proc/" (number->string pid) "/ns/user")) 82 (string-append "/proc/" (number->string pid) "/ns/user"))
82 83
83(unless (file-exists? (user-namespace (getpid))) 84(define perform-container-tests?
85 (and (user-namespace-supported?)
86 (unprivileged-user-namespace-supported?)))
87
88(unless perform-container-tests?
84 (test-skip 1)) 89 (test-skip 1))
85(test-assert "clone" 90(test-assert "clone"
86 (match (clone (logior CLONE_NEWUSER SIGCHLD)) 91 (match (clone (logior CLONE_NEWUSER SIGCHLD))
@@ -93,7 +98,7 @@
93 ((_ . status) 98 ((_ . status)
94 (= 42 (status:exit-val status)))))))) 99 (= 42 (status:exit-val status))))))))
95 100
96(unless (file-exists? (user-namespace (getpid))) 101(unless perform-container-tests?
97 (test-skip 1)) 102 (test-skip 1))
98(test-assert "setns" 103(test-assert "setns"
99 (match (clone (logior CLONE_NEWUSER SIGCHLD)) 104 (match (clone (logior CLONE_NEWUSER SIGCHLD))
@@ -122,7 +127,7 @@
122 (waitpid fork-pid) 127 (waitpid fork-pid)
123 result)))))))) 128 result))))))))
124 129
125(unless (file-exists? (user-namespace (getpid))) 130(unless perform-container-tests?
126 (test-skip 1)) 131 (test-skip 1))
127(test-assert "pivot-root" 132(test-assert "pivot-root"
128 (match (pipe) 133 (match (pipe)