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) | |
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 c11cdd1ce55..5a0f9937bb8 100644 --- a/tests/containers.scm +++ b/tests/containers.scm | |||
| @@ -79,6 +79,18 @@ | |||
| 79 | (assert-exit (file-exists? "/testing"))) | 79 | (assert-exit (file-exists? "/testing"))) |
| 80 | #:namespaces '(user mnt)))) | 80 | #:namespaces '(user mnt)))) |
| 81 | 81 | ||
| 82 | (test-equal "call-with-container, mnt namespace, wrong bind mount" | ||
| 83 | `(system-error ,ENOENT) | ||
| 84 | ;; An exception should be raised; see <http://bugs.gnu.org/23306>. | ||
| 85 | (catch 'system-error | ||
| 86 | (lambda () | ||
| 87 | (call-with-container '(("/does-not-exist" device "/foo" | ||
| 88 | "none" (bind-mount) #f #f)) | ||
| 89 | (const #t) | ||
| 90 | #:namespaces '(user mnt))) | ||
| 91 | (lambda args | ||
| 92 | (list 'system-error (system-error-errno args))))) | ||
| 93 | |||
| 82 | (test-assert "call-with-container, all namespaces" | 94 | (test-assert "call-with-container, all namespaces" |
| 83 | (zero? | 95 | (zero? |
| 84 | (call-with-container '() | 96 | (call-with-container '() |
diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh index 0a7ea481fca..5ea6c49263d 100644 --- a/tests/guix-environment-container.sh +++ b/tests/guix-environment-container.sh | |||
| @@ -44,6 +44,16 @@ else | |||
| 44 | test $? = 42 | 44 | test $? = 42 |
| 45 | fi | 45 | fi |
| 46 | 46 | ||
| 47 | # Make sure file-not-found errors in mounts are reported. | ||
| 48 | if guix environment --container --ad-hoc --bootstrap guile-bootstrap \ | ||
| 49 | --expose=/does-not-exist -- guile -c 1 2> "$tmpdir/error" | ||
| 50 | then | ||
| 51 | false | ||
| 52 | else | ||
| 53 | grep "/does-not-exist" "$tmpdir/error" | ||
| 54 | grep "[Nn]o such file" "$tmpdir/error" | ||
| 55 | fi | ||
| 56 | |||
| 47 | # Make sure that the right directories are mapped. | 57 | # Make sure that the right directories are mapped. |
| 48 | mount_test_code=" | 58 | mount_test_code=" |
| 49 | (use-modules (ice-9 rdelim) | 59 | (use-modules (ice-9 rdelim) |
