summaryrefslogtreecommitdiff
path: root/tests/containers.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-30 22:44:58 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-31 00:11:04 +0200
commitc06f6db7a424fd47e3cd2625dbfda2367316f3bd (patch)
tree025d18dd2ed6d4f6a62cc09aa9633161c7d7edc8 /tests/containers.scm
parent4c14d4eaa7ee9d5d89c04a41adb50c7c532d14e1 (diff)
downloadgnu-guix-c06f6db7a424fd47e3cd2625dbfda2367316f3bd.tar
gnu-guix-c06f6db7a424fd47e3cd2625dbfda2367316f3bd.tar.gz
container: Gracefully report mount errors in the child process.
Fixes <http://bugs.gnu.org/23306>. * gnu/build/linux-container.scm (run-container): Use 'socketpair' instead of 'pipe'. Rename 'in' to 'child' and 'out' to 'parent'. Send a 'ready message or an exception argument list from the child to the parent; adjust the parent accordingly. * tests/containers.scm ("call-with-container, mnt namespace, wrong bind mount"): New test. * tests/guix-environment-container.sh: Add test with --expose=/does-not-exist.
Diffstat (limited to 'tests/containers.scm')
-rw-r--r--tests/containers.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/containers.scm b/tests/containers.scm
index c11cdd1ce5..5a0f9937bb 100644
--- a/tests/containers.scm
+++ b/tests/containers.scm
@@ -79,6 +79,18 @@
(assert-exit (file-exists? "/testing")))
#:namespaces '(user mnt))))
+(test-equal "call-with-container, mnt namespace, wrong bind mount"
+ `(system-error ,ENOENT)
+ ;; An exception should be raised; see <http://bugs.gnu.org/23306>.
+ (catch 'system-error
+ (lambda ()
+ (call-with-container '(("/does-not-exist" device "/foo"
+ "none" (bind-mount) #f #f))
+ (const #t)
+ #:namespaces '(user mnt)))
+ (lambda args
+ (list 'system-error (system-error-errno args)))))
+
(test-assert "call-with-container, all namespaces"
(zero?
(call-with-container '()