diff options
Diffstat (limited to 'gnu/tests')
-rw-r--r-- | gnu/tests/base.scm | 37 | ||||
-rw-r--r-- | gnu/tests/foreign.scm | 43 |
2 files changed, 72 insertions, 8 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index f96d781b52..659b754802 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -1116,6 +1116,32 @@ non-ASCII names from /tmp.") evaluated in MARIONETTE, a gexp denoting a marionette (system under test). Assume that an unprivileged account for 'user' exists on the system under test." + (define chown-snippet + ;; XXX: This snippet exists primarily so that #$output is understood in + ;; the right context. + '(object->string + `(begin + (use-modules (guix) + (gnu packages bootstrap)) + (computed-file "chown-to-supplementary-group" + #~(begin + (use-modules (srfi srfi-1)) + + ',(gettimeofday) ;nonce + (let* ((groups (getgroups)) + (other (find (lambda (gid) + (not (= gid (getgid)))) + (vector->list groups)))) + (format #t "attempting to chown \ +to supplementary group ~a...~%" other) + (pk 'supplementary-groups (getgroups) + 'gid (getgid) 'other other) + (force-output) + (mkdir "test") + (chown "test" (getuid) other) + (mkdir #$output))) + #:guile %bootstrap-guile)))) + #~(begin (test-equal "guix describe" 0 @@ -1143,6 +1169,17 @@ test." hello)) #$marionette)) + (test-equal "kvm GID mapped" + 0 + ;; The "kvm" group should be among the supplementary groups of the + ;; build user. Try to chown a file to that group; this fails with + ;; EINVAL when running the unprivileged guix-daemon and the "kvm" GID + ;; is not mapped in its user namespace. See + ;; <https://bugs.gnu.org/77862>. + (marionette-eval + '(system* "guix" "build" "--no-grafts" "-e" #$chown-snippet) + #$marionette)) + (test-equal "guix install hello" 0 ;; Check that ~/.guix-profile & co. are properly created. diff --git a/gnu/tests/foreign.scm b/gnu/tests/foreign.scm index 52ead49a24..2d587953dd 100644 --- a/gnu/tests/foreign.scm +++ b/gnu/tests/foreign.scm @@ -159,10 +159,12 @@ system is expected to be on DEVICE." (file-append (package-source guix) "/etc/guix-install.sh")) (define* (run-foreign-install-test image name - #:key (device "/dev/vdb1")) + #:key (device "/dev/vdb1") + (deb-files '())) "Run an installation of Guix in IMAGE, the QCOW2 image of a systemd-based GNU/Linux distro, and check that the installation is functional. The root -partition of IMAGE is expected to be on DEVICE." +partition of IMAGE is expected to be on DEVICE. Prior to that, install all +of DEB-FILES with 'dpkg -i'." (define instrumented-image (qcow-image-with-marionette image #:name (string-append name ".qcow2") @@ -234,6 +236,14 @@ partition of IMAGE is expected to be on DEVICE." #t) marionette)) + (test-assert "install extra .deb packages" + (marionette-eval + '(and #$@(map (lambda (deb) + #~(system* "dpkg" "-i" + (in-vicinity "/host" (basename #$deb)))) + deb-files)) + marionette)) + (test-assert "run install script" (marionette-eval '(system (string-append @@ -272,36 +282,53 @@ partition of IMAGE is expected to be on DEVICE." #:localstatedir? #t))) (gexp->derivation name (test tarball)))) -(define debian-12-qcow2 +(define debian-13-qcow2 ;; Image taken from <https://www.debian.org/distrib/>. ;; XXX: Those images are periodically removed from debian.org. (origin (uri - "https://cloud.debian.org/images/cloud/bookworm/20250210-2019/debian-12-nocloud-amd64-20250210-2019.qcow2") + "https://cloud.debian.org/images/cloud/trixie/latest/debian-13-nocloud-amd64.qcow2") + (method url-fetch) + (sha256 + (base32 + "0g7kcvz2yzr0xchlv5kc8d2rd2lzk4akh02i43i92cmys7q3r05c")))) + +(define debian-uidmap-deb-file + ;; This package provides 'newgidmap' & co., used by the unprivileged daemon. + (origin + (uri + "http://ftp.debian.org/debian/pool/main/s/shadow/uidmap_4.13+dfsg1-1+deb12u1_amd64.deb") (method url-fetch) (sha256 (base32 - "06vlcq2dzgczlyp9lfkkdf3dgvfjp22lh5xz0mnl0bdgzq61sykb")))) + "0iqhljzmnni3k3jc1xb0mrb7cqywkzrmdc2322kd8b1wpw45zv8l")))) +;; This test starts failing when derivations in repo for GNU Hello and its dependencies +;; differs from versions in current Guix package. The simple way to fix it is to update +;; Guix package version. (define %test-debian-install (system-test (name "debian-install") (description "Test installation of Guix on Debian using the @file{guix-install.sh} script.") - (value (run-foreign-install-test debian-12-qcow2 name)))) + (value (run-foreign-install-test debian-13-qcow2 name + #:deb-files (list debian-uidmap-deb-file))))) (define archlinux-qcow2 ;; Images generated by <https://gitlab.archlinux.org/archlinux/arch-boxes>; ;; using default mirror mentioned in README there. ;; XXX: These images are removed every ~90 days (origin - (uri "https://geo.mirror.pkgbuild.com/images/v20250615.366044/Arch-Linux-x86_64-basic.qcow2") + (uri "https://geo.mirror.pkgbuild.com/images/v20251015.435734/Arch-Linux-x86_64-basic.qcow2") (method url-fetch) (sha256 (base32 - "11m945cv5hgfa7zgkvd7fqgqfp3vdq3c4bdh3x0ilza36w5xcn1b")))) + "0mlvfsw9ak9b6cl5h0mhs90vqkqd3ha3lx4rv9xg2b510q6656li")))) +;; This test starts failing when derivations in repo for GNU Hello and its dependencies +;; differs from versions in current Guix package. The simple way to fix it is to update +;; Guix package version. (define %test-archlinux-install (system-test (name "archlinux-install") |