summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/syscalls.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 4bc6f0332ce..9b8ac9e6033 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -90,6 +90,32 @@
90 ((_ . status) 90 ((_ . status)
91 (= 42 (status:exit-val status)))))))) 91 (= 42 (status:exit-val status))))))))
92 92
93(test-assert "setns"
94 (match (clone (logior CLONE_NEWUSER SIGCHLD))
95 (0 (primitive-exit 0))
96 (clone-pid
97 (match (pipe)
98 ((in . out)
99 (match (primitive-fork)
100 (0
101 (close in)
102 ;; Join the user namespace.
103 (call-with-input-file (user-namespace clone-pid)
104 (lambda (port)
105 (setns (port->fdes port) 0)))
106 (write 'done out)
107 (close out)
108 (primitive-exit 0))
109 (fork-pid
110 (close out)
111 ;; Wait for the child process to join the namespace.
112 (read in)
113 (let ((result (and (equal? (readlink (user-namespace clone-pid))
114 (readlink (user-namespace fork-pid))))))
115 ;; Clean up.
116 (waitpid clone-pid)
117 (waitpid fork-pid)
118 result))))))))
93 119
94(test-assert "all-network-interfaces" 120(test-assert "all-network-interfaces"
95 (match (all-network-interfaces) 121 (match (all-network-interfaces)