diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2025-01-22 23:48:14 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-03-26 17:57:44 +0100 |
| commit | 2f65438eba584c5c0181af917445bb6025d3d0c8 (patch) | |
| tree | fa48bad3063e290a20634cdb0bfa5f218ec2408c /build-aux | |
| parent | f854095b6ffb6ed86c8a66126825b7d41b5ccf96 (diff) | |
tests: Run in a chroot and unprivileged user namespaces.
* build-aux/test-env.in: Pass ‘--disable-chroot’ only when unprivileged
user namespace support is lacking and warn in that case.
* tests/store.scm ("build-things, check mode"): Use ‘gettimeofday’
rather than a shared file as a source of entropy.
("symlink is symlink")
("isolated environment", "inputs are read-only")
("inputs cannot be remounted read-write")
("build root cannot be made world-readable")
("/tmp, store, and /dev/{null,full} are writable")
("network is unreachable"): New tests.
* tests/processes.scm ("client + lock"): Skip when
‘unprivileged-user-namespace-supported?’ returns true.
Change-Id: I3b3c3ebdf6db5fd36ee70251d07b893c17ca1b84
Diffstat (limited to 'build-aux')
| -rw-r--r-- | build-aux/test-env.in | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/build-aux/test-env.in b/build-aux/test-env.in index 9caa29da581..86c2e585d73 100644 --- a/build-aux/test-env.in +++ b/build-aux/test-env.in | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # GNU Guix --- Functional package management for GNU | 3 | # GNU Guix --- Functional package management for GNU |
| 4 | # Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021 Ludovic Courtès <ludo@gnu.org> | 4 | # Copyright © 2012-2019, 2021, 2025 Ludovic Courtès <ludo@gnu.org> |
| 5 | # | 5 | # |
| 6 | # This file is part of GNU Guix. | 6 | # This file is part of GNU Guix. |
| 7 | # | 7 | # |
| @@ -102,10 +102,24 @@ then | |||
| 102 | rm -rf "$GUIX_STATE_DIRECTORY/daemon-socket" | 102 | rm -rf "$GUIX_STATE_DIRECTORY/daemon-socket" |
| 103 | mkdir -m 0700 "$GUIX_STATE_DIRECTORY/daemon-socket" | 103 | mkdir -m 0700 "$GUIX_STATE_DIRECTORY/daemon-socket" |
| 104 | 104 | ||
| 105 | # If unprivileged user namespaces are not supported, pass | ||
| 106 | # '--disable-chroot'. | ||
| 107 | if [ -f /proc/self/ns/user ] \ | ||
| 108 | && { [ ! -f /proc/sys/kernel/unprivileged_userns_clone ] \ | ||
| 109 | || [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" -eq 1 ]; } | ||
| 110 | then | ||
| 111 | extra_options="" | ||
| 112 | else | ||
| 113 | extra_options="--disable-chroot" | ||
| 114 | echo "unprivileged user namespaces not supported; \ | ||
| 115 | running 'guix-daemon $extra_options'" >&2 | ||
| 116 | fi | ||
| 117 | |||
| 105 | # Launch the daemon without chroot support because is may be | 118 | # Launch the daemon without chroot support because is may be |
| 106 | # unavailable, for instance if we're not running as root. | 119 | # unavailable, for instance if we're not running as root. |
| 107 | "@abs_top_builddir@/pre-inst-env" \ | 120 | "@abs_top_builddir@/pre-inst-env" \ |
| 108 | "@abs_top_builddir@/guix-daemon" --disable-chroot \ | 121 | "@abs_top_builddir@/guix-daemon" \ |
| 122 | $extra_options \ | ||
| 109 | --substitute-urls="$GUIX_BINARY_SUBSTITUTE_URL" & | 123 | --substitute-urls="$GUIX_BINARY_SUBSTITUTE_URL" & |
| 110 | 124 | ||
| 111 | daemon_pid=$! | 125 | daemon_pid=$! |
