diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-05-30 22:44:58 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-05-31 00:11:04 +0200 |
commit | c06f6db7a424fd47e3cd2625dbfda2367316f3bd (patch) | |
tree | 025d18dd2ed6d4f6a62cc09aa9633161c7d7edc8 /tests | |
parent | 4c14d4eaa7ee9d5d89c04a41adb50c7c532d14e1 (diff) | |
download | guix-c06f6db7a424fd47e3cd2625dbfda2367316f3bd.tar.gz guix-c06f6db7a424fd47e3cd2625dbfda2367316f3bd.zip |
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')
-rw-r--r-- | tests/containers.scm | 12 | ||||
-rw-r--r-- | tests/guix-environment-container.sh | 10 |
2 files changed, 22 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 '() diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh index 0a7ea481fc..5ea6c49263 100644 --- a/tests/guix-environment-container.sh +++ b/tests/guix-environment-container.sh @@ -44,6 +44,16 @@ else test $? = 42 fi +# Make sure file-not-found errors in mounts are reported. +if guix environment --container --ad-hoc --bootstrap guile-bootstrap \ + --expose=/does-not-exist -- guile -c 1 2> "$tmpdir/error" +then + false +else + grep "/does-not-exist" "$tmpdir/error" + grep "[Nn]o such file" "$tmpdir/error" +fi + # Make sure that the right directories are mapped. mount_test_code=" (use-modules (ice-9 rdelim) |