summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim@guixotic.coop>2025-10-16 16:36:43 +0900
committerMaxim Cournoyer <maxim@guixotic.coop>2025-10-29 11:34:28 +0900
commit10edda5aa5f92e7bfcff4902d4f3c11373d1e725 (patch)
tree95cff7d390183e858722a085d13fb00a5a67863f /tests
parentd0144544ff38c62ee92b6f3b6ee3e6aa6aede812 (diff)
Reinstate "linux-container: Remove #:lock-mounts? and related code."
This reverts commit e0e64be8de3d220a12612b3a2e4aee428277d865.
Diffstat (limited to 'tests')
-rw-r--r--tests/containers.scm33
1 files changed, 29 insertions, 4 deletions
diff --git a/tests/containers.scm b/tests/containers.scm
index 1e915d517e8..6edea9631dc 100644
--- a/tests/containers.scm
+++ b/tests/containers.scm
@@ -1,6 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 David Thompson <davet@gnu.org> 2;;; Copyright © 2015 David Thompson <davet@gnu.org>
3;;; Copyright © 2016, 2017, 2019, 2023 Ludovic Courtès <ludo@gnu.org> 3;;; Copyright © 2016-2017, 2019, 2023, 2025 Ludovic Courtès <ludo@gnu.org>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
6;;; 6;;;
@@ -111,6 +111,26 @@
111 #:namespaces '(user mnt)))) 111 #:namespaces '(user mnt))))
112 112
113(skip-if-unsupported) 113(skip-if-unsupported)
114(test-equal "call-with-container, mnt namespace, locked mounts"
115 EINVAL
116 ;; umount(2) fails with EINVAL when targeting a mount point that is
117 ;; "locked".
118 (status:exit-val
119 (call-with-container (list (file-system
120 (device "none")
121 (mount-point "/testing")
122 (type "tmpfs")
123 (check? #f)))
124 (lambda ()
125 (primitive-exit (catch 'system-error
126 (lambda ()
127 (umount "/testing")
128 0)
129 (lambda args
130 (system-error-errno args)))))
131 #:namespaces '(user mnt))))
132
133(skip-if-unsupported)
114(test-equal "call-with-container, mnt namespace, wrong bind mount" 134(test-equal "call-with-container, mnt namespace, wrong bind mount"
115 `(system-error ,ENOENT) 135 `(system-error ,ENOENT)
116 ;; An exception should be raised; see <http://bugs.gnu.org/23306>. 136 ;; An exception should be raised; see <http://bugs.gnu.org/23306>.
@@ -169,7 +189,8 @@
169 #:namespaces '(user mnt)))) 189 #:namespaces '(user mnt))))
170 190
171(skip-if-unsupported) 191(skip-if-unsupported)
172(test-assert "container-excursion" 192(test-equal "container-excursion"
193 0
173 (call-with-temporary-directory 194 (call-with-temporary-directory
174 (lambda (root) 195 (lambda (root)
175 ;; Two pipes: One for the container to signal that the test can begin, 196 ;; Two pipes: One for the container to signal that the test can begin,
@@ -193,7 +214,11 @@
193 (readlink (string-append "/proc/" pid "/ns/" ns))) 214 (readlink (string-append "/proc/" pid "/ns/" ns)))
194 '("user" "ipc" "uts" "net" "pid" "mnt")))) 215 '("user" "ipc" "uts" "net" "pid" "mnt"))))
195 216
196 (let* ((pid (run-container root '() %namespaces 1 container)) 217 (let* ((pid (run-container root '() %namespaces 1 container
218 ;; Do not lock mounts so the user namespace
219 ;; appears to be the same seen from inside
220 ;; and from outside.
221 #:lock-mounts? #f))
197 (container-namespaces (namespaces pid)) 222 (container-namespaces (namespaces pid))
198 (result 223 (result
199 (begin 224 (begin
@@ -213,7 +238,7 @@
213 (write 'done end-out) 238 (write 'done end-out)
214 (close end-out) 239 (close end-out)
215 (waitpid pid) 240 (waitpid pid)
216 (zero? result))))))) 241 result))))))
217 242
218(skip-if-unsupported) 243(skip-if-unsupported)
219(test-equal "container-excursion, same namespaces" 244(test-equal "container-excursion, same namespaces"