diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-10-18 23:22:03 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-10-19 15:54:10 +0200 |
| commit | 7fee5b53973fb4fe049aa0bc5db58093727bdf30 (patch) | |
| tree | b392d7b204098a4dfa3113c7d7fa7f801de11546 /tests/containers.scm | |
| parent | 99df12cd1921dd497bb4fcdd96ee40e358d71e6d (diff) | |
container: Allow 'container-excursion' to the same namespaces.
Before that, 'container-excursion' would call 'setns' even when the
target namespace is the one the caller is already in, which would fail.
* gnu/build/linux-container.scm (container-excursion): Introduce
'source' and 'target'. Compare the result of 'readlink' on these
instead of comparing file descriptors to decide whether to call
'setns'.
* tests/containers.scm ("container-excursion, same namespace"): New test.
Diffstat (limited to 'tests/containers.scm')
| -rw-r--r-- | tests/containers.scm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/containers.scm b/tests/containers.scm index bbcff3f51f6..698bef3e47c 100644 --- a/tests/containers.scm +++ b/tests/containers.scm | |||
| @@ -162,4 +162,13 @@ | |||
| 162 | (waitpid pid) | 162 | (waitpid pid) |
| 163 | (zero? result))))))) | 163 | (zero? result))))))) |
| 164 | 164 | ||
| 165 | (skip-if-unsupported) | ||
| 166 | (test-equal "container-excursion, same namespaces" | ||
| 167 | 42 | ||
| 168 | ;; The parent and child are in the same namespaces. 'container-excursion' | ||
| 169 | ;; should notice that and avoid calling 'setns' since that would fail. | ||
| 170 | (container-excursion (getpid) | ||
| 171 | (lambda () | ||
| 172 | (primitive-exit 42)))) | ||
| 173 | |||
| 165 | (test-end) | 174 | (test-end) |
