summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorRodion Goritskov <rodion@goritskov.com>2025-12-25 20:59:20 +0100
committerRutherther <rutherther@ditigal.xyz>2025-12-28 12:38:29 +0100
commit65432c00fc00327aa07228a115446e55005cad94 (patch)
treecd5fdb8efbfa47f8919446b702fea3eb05fcc13f /gnu/tests
parentf1c1fb93405e6a9ca7904d32cf0a6ac28add1738 (diff)
tests: Add Fedora foreign distribution test.
* gnu/tests/foreign.scm (qcow-image-with-marionette): - Create .autorelabel file to make copied Guile work on SELinux-enabled systems. (resize-lvm-xfs-partition): New variable. (run-foreign-install-test): Increase RAM for VM to 1024 as 512 is not sufficient to run Guix installation on Fedora. (fedora-qcow2): New variable. (%test-fedora-install): New variable. Change-Id: Ib247a174dfea8630d830763410391077516a8c16 Merges: #5007
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/foreign.scm60
1 files changed, 57 insertions, 3 deletions
diff --git a/gnu/tests/foreign.scm b/gnu/tests/foreign.scm
index 7ef64534c8d..82e2f2d8709 100644
--- a/gnu/tests/foreign.scm
+++ b/gnu/tests/foreign.scm
@@ -42,7 +42,8 @@
42 #:use-module (srfi srfi-9) 42 #:use-module (srfi srfi-9)
43 #:export (%test-debian-install 43 #:export (%test-debian-install
44 %test-archlinux-install 44 %test-archlinux-install
45 %test-ubuntu-install)) 45 %test-ubuntu-install
46 %test-fedora-install))
46 47
47(define marionette-systemd-service 48(define marionette-systemd-service
48 ;; Definition of the marionette service for systemd. 49 ;; Definition of the marionette service for systemd.
@@ -73,7 +74,7 @@ marionette. This procedure will be called from within a VM and it should
73resize the partition and file system, if appropriate." 74resize the partition and file system, if appropriate."
74 (define vm 75 (define vm
75 (virtual-machine 76 (virtual-machine
76 (marionette-operating-system %simple-os))) 77 (marionette-operating-system %simple-os)))
77 78
78 (define build 79 (define build
79 (with-imported-modules (source-module-closure 80 (with-imported-modules (source-module-closure
@@ -109,6 +110,9 @@ resize the partition and file system, if appropriate."
109 marionette)) 110 marionette))
110 (error "failed to mount foreign distro image" #$device)) 111 (error "failed to mount foreign distro image" #$device))
111 112
113 ;; Make newly copied files relabeled for SELinux-enabled distributions
114 (marionette-eval '(system* "touch" "/mnt/.autorelabel") marionette)
115
112 (marionette-eval '(system* "ls" "-la" "/mnt") 116 (marionette-eval '(system* "ls" "-la" "/mnt")
113 marionette) 117 marionette)
114 (marionette-eval '(begin 118 (marionette-eval '(begin
@@ -176,6 +180,35 @@ resize the partition and file system, if appropriate."
176 marionette)) 180 marionette))
177 (error "failed to grow the file system")))) 181 (error "failed to grow the file system"))))
178 182
183(define resize-lvm-xfs-partition
184 ;; Gexp evaluating to a two-argument procedure, taking DEVICE and
185 ;; MARIONETTE. It will grow the given device and its file system to 100 %
186 ;; of the empty space on the image.
187 #~(lambda (device marionette)
188
189 (unless (zero? (marionette-eval `(begin
190 (system* #$(file-append lvm2 "/sbin/pvscan"))
191 (system* #$(file-append lvm2 "/sbin/vgscan"))
192 (system* #$(file-append lvm2 "/sbin/vgchange") "-a" "y")
193 (system* #$(file-append lvm2 "/sbin/lvscan"))
194 (system* #$(file-append lvm2 "/sbin/lvextend") "-l" "+100%FREE" ,device))
195 marionette))
196 `(error "failed to extend logical volume" ,device))
197
198 (unless (zero? (marionette-eval `(system* "mount" ,device "/mnt")
199 marionette))
200 `(error "failed to mount foreign distro image" ,device))
201
202 (unless (zero? (marionette-eval
203 `(system* #$(file-append xfsprogs "/sbin/xfs_growfs")
204 ,device)
205 marionette))
206 (error "failed to grow the file system"))
207
208 (unless (zero? (marionette-eval '(system* "umount" "/mnt")
209 marionette))
210 (error "failed to unmount device"))))
211
179(define (manifest-entry-without-grafts entry) 212(define (manifest-entry-without-grafts entry)
180 "Return ENTRY with grafts disabled on its contents." 213 "Return ENTRY with grafts disabled on its contents."
181 (manifest-entry 214 (manifest-entry
@@ -239,7 +272,7 @@ and file system, if appropriate."
239 (list (%store-prefix)) 272 (list (%store-prefix))
240 #:image-format "qcow2" 273 #:image-format "qcow2"
241 #:rw-image? #t) 274 #:rw-image? #t)
242 "-m" "512" 275 "-m" "1024"
243 "-snapshot"))) 276 "-snapshot")))
244 277
245 (test-runner-current (system-test-runner #$output)) 278 (test-runner-current (system-test-runner #$output))
@@ -466,3 +499,24 @@ script.")
466 ubuntu-uidmap-deb-file) 499 ubuntu-uidmap-deb-file)
467 #:resize-image "+1G" 500 #:resize-image "+1G"
468 #:resize-proc resize-ext4-partition)))) 501 #:resize-proc resize-ext4-partition))))
502(define fedora-qcow2
503 (origin
504 (uri "https://download.fedoraproject.org/pub/fedora/linux/releases/43/Server/x86_64/images/Fedora-Server-Guest-Generic-43-1.6.x86_64.qcow2")
505 (method url-fetch)
506 (sha256
507 (base32
508 "0j142kbrfcv9fwds4bw57dqhnjvpzd6d6m15ar3sgf1yw9dq0pac"))))
509
510;; This test starts failing when derivations in repo for GNU Hello and its dependencies
511;; differs from versions in current Guix package. The simple way to fix it is to update
512;; Guix package version.
513(define %test-fedora-install
514 (system-test
515 (name "fedora-install")
516 (description
517 "Test installation of Guix on Fedora Linux using the @file{guix-install.sh}
518script.")
519 (value (run-foreign-install-test fedora-qcow2 name
520 #:device "/dev/systemVG/LVRoot"
521 #:resize-image "+1G"
522 #:resize-proc resize-lvm-xfs-partition))))