test-name: call-with-container, exit with 0 when there is no error location: /data/paul/sourceCode/guix/tests/containers.scm:41 source: + (test-assert + "call-with-container, exit with 0 when there is no error" + (zero? (call-with-container + '() + (const #t) + #:namespaces + '(user)))) actual-value: #f actual-error: + (system-error + "clone" + "~d: ~A" + (268435473 "Invalid argument") + (22)) result: FAIL test-name: call-with-container, user namespace location: /data/paul/sourceCode/guix/tests/containers.scm:46 source: + (test-assert + "call-with-container, user namespace" + (zero? (call-with-container + '() + (lambda () + (assert-exit + (and (zero? (getuid)) (zero? (getgid))))) + #:namespaces + '(user)))) actual-value: #f actual-error: + (system-error + "clone" + "~d: ~A" + (268435473 "Invalid argument") + (22)) result: FAIL test-name: call-with-container, uts namespace location: /data/paul/sourceCode/guix/tests/containers.scm:55 source: + (test-assert + "call-with-container, uts namespace" + (zero? (call-with-container + '() + (lambda () + (sethostname "test-container") + (primitive-exit 0)) + #:namespaces + '(user uts)))) actual-value: #f actual-error: + (system-error + "clone" + "~d: ~A" + (335544337 "Invalid argument") + (22)) result: FAIL test-name: call-with-container, pid namespace location: /data/paul/sourceCode/guix/tests/containers.scm:66 source: + (test-assert + "call-with-container, pid namespace" + (zero? (call-with-container + '() + (lambda () + (match (primitive-fork) + (0 (assert-exit (= 2 (getpid)))) + (pid (primitive-exit + (match (waitpid pid) + ((_ . status) + (status:exit-val status))))))) + #:namespaces + '(user pid)))) actual-value: #f actual-error: + (system-error + "clone" + "~d: ~A" + (805306385 "Invalid argument") + (22)) result: FAIL test-name: call-with-container, mnt namespace location: /data/paul/sourceCode/guix/tests/containers.scm:82 source: + (test-assert + "call-with-container, mnt namespace" + (zero? (call-with-container + (list (file-system + (device "none") + (mount-point "/testing") + (type "tmpfs") + (check? #f))) + (lambda () + (assert-exit (file-exists? "/testing"))) + #:namespaces + '(user mnt)))) actual-value: #f actual-error: + (system-error + "clone" + "~d: ~A" + (268566545 "Invalid argument") + (22)) result: FAIL test-name: call-with-container, mnt namespace, wrong bind mount location: /data/paul/sourceCode/guix/tests/containers.scm:94 source: + (test-equal + "call-with-container, mnt namespace, wrong bind mount" + `(system-error ,ENOENT) + (catch 'system-error + (lambda () + (call-with-container + (list (file-system + (device "/does-not-exist") + (mount-point "/foo") + (type "none") + (flags '(bind-mount)) + (check? #f))) + (const #t) + #:namespaces + '(user mnt))) + (lambda args + (list 'system-error (system-error-errno args))))) expected-value: (system-error 2) actual-value: (system-error 22) result: FAIL test-name: call-with-container, all namespaces location: /data/paul/sourceCode/guix/tests/containers.scm:111 source: + (test-assert + "call-with-container, all namespaces" + (zero? (call-with-container + '() + (lambda () (primitive-exit 0))))) actual-value: #f actual-error: + (system-error + "clone" + "~d: ~A" + (2080505873 "Invalid argument") + (22)) result: FAIL test-name: container-excursion location: /data/paul/sourceCode/guix/tests/containers.scm:118 source: + (test-assert + "container-excursion" + (call-with-temporary-directory + (lambda (root) + (match (list (pipe) (pipe)) + (((start-in . start-out) (end-in . end-out)) + (define (container) + (close end-out) + (close start-in) + (write 'ready start-out) + (close start-out) + (read end-in) + (close end-in)) + (define (namespaces pid) + (let ((pid (number->string pid))) + (map (lambda (ns) + (readlink (string-append "/proc/" pid "/ns/" ns))) + '("user" "ipc" "uts" "net" "pid" "mnt")))) + (let* ((pid (run-container root '() %namespaces 1 container)) + (container-namespaces (namespaces pid)) + (result + (begin + (close start-out) + (read start-in) + (close start-in) + (container-excursion + pid + (lambda () + (match (primitive-fork) + (0 + (assert-exit + (equal? + container-namespaces + (namespaces (getpid))))) + (fork-pid + (match (waitpid fork-pid) + ((_ . status) + (primitive-exit + (status:exit-val + status))))))))))) + (close end-in) + (write 'done end-out) + (close end-out) + (waitpid pid) + (zero? result))))))) actual-value: #f actual-error: + (system-error + "clone" + "~d: ~A" + (2080505873 "Invalid argument") + (22)) result: FAIL test-name: container-excursion, same namespaces location: /data/paul/sourceCode/guix/tests/containers.scm:175 source: + (test-equal + "container-excursion, same namespaces" + 42 + (container-excursion + (getpid) + (lambda () (primitive-exit 42)))) expected-value: 42 actual-value: 42 result: PASS test-name: container-excursion* location: /data/paul/sourceCode/guix/tests/containers.scm:184 source: + (test-assert + "container-excursion*" + (call-with-temporary-directory + (lambda (root) + (define (namespaces pid) + (let ((pid (number->string pid))) + (map (lambda (ns) + (readlink (string-append "/proc/" pid "/ns/" ns))) + '("user" "ipc" "uts" "net" "pid" "mnt")))) + (let* ((pid (run-container + root + '() + %namespaces + 1 + (lambda () (sleep 100)))) + (expected (namespaces pid)) + (result + (container-excursion* + pid + (lambda () (namespaces 1))))) + (kill pid SIGKILL) + (equal? result expected))))) actual-value: #f actual-error: + (system-error + "clone" + "~d: ~A" + (2080505873 "Invalid argument") + (22)) result: FAIL test-name: container-excursion*, same namespaces location: /data/paul/sourceCode/guix/tests/containers.scm:205 source: + (test-equal + "container-excursion*, same namespaces" + 42 + (container-excursion* + (getpid) + (lambda () (* 6 7)))) expected-value: 42 actual-value: 42 result: PASS