tests: Test installation with a RAID root partition.

* gnu/tests/install.scm (%raid-root-os, %raid-root-os-source)
(%raid-root-installation-script, %test-raid-root-os): New variables.
This commit is contained in:
Ludovic Courtès 2016-10-27 13:46:43 +02:00
parent 49baaff4d2
commit 245cc5f5d5
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 84 additions and 0 deletions

View File

@ -34,6 +34,7 @@
#:use-module (guix utils)
#:export (%test-installed-os
%test-separate-store-os
%test-raid-root-os
%test-encrypted-os))
;;; Commentary:
@ -299,6 +300,89 @@ where /gnu lives on a separate partition.")
(command (qemu-command/writable-image image)))
(run-basic-test %separate-store-os command "separate-store-os")))))
;;;
;;; RAID root device.
;;;
(define-os-with-source (%raid-root-os %raid-root-os-source)
;; An OS whose root partition is a RAID partition.
(use-modules (gnu) (gnu tests))
(operating-system
(host-name "raidified")
(timezone "Europe/Paris")
(locale "en_US.utf8")
(bootloader (grub-configuration (device "/dev/vdb")))
(kernel-arguments '("console=ttyS0"))
(initrd (lambda (file-systems . rest)
;; Add a kernel module for RAID-0 (aka. "stripe").
(apply base-initrd file-systems
#:extra-modules '("raid0")
rest)))
(mapped-devices (list (mapped-device
(source (list "/dev/vda2" "/dev/vda3"))
(target "/dev/md0")
(type raid-device-mapping))))
(file-systems (cons (file-system
(device "root-fs")
(title 'label)
(mount-point "/")
(type "ext4")
(dependencies mapped-devices))
%base-file-systems))
(users %base-user-accounts)
(services (cons (service marionette-service-type
(marionette-configuration
(imported-modules '((gnu services herd)
(guix combinators)))))
%base-services))))
(define %raid-root-installation-script
;; Installation with a separate /gnu partition. See
;; <https://raid.wiki.kernel.org/index.php/RAID_setup> for more on RAID and
;; mdadm.
"\
. /etc/profile
set -e -x
guix --version
export GUIX_BUILD_OPTIONS=--no-grafts
parted --script /dev/vdb mklabel gpt \\
mkpart primary ext2 1M 3M \\
mkpart primary ext2 3M 600M \\
mkpart primary ext2 600M 1200M \\
set 1 boot on \\
set 1 bios_grub on
mdadm --create /dev/md0 --verbose --level=stripe --raid-devices=2 \\
/dev/vdb2 /dev/vdb3
mkfs.ext4 -L root-fs /dev/md0
mount /dev/md0 /mnt
df -h /mnt
herd start cow-store /mnt
mkdir /mnt/etc
cp /etc/target-config.scm /mnt/etc/config.scm
guix system init /mnt/etc/config.scm /mnt --no-substitutes
sync
reboot\n")
(define %test-raid-root-os
(system-test
(name "raid-root-os")
(description
"Test functionality of an OS installed with a RAID root partition managed
by 'mdadm'.")
(value
(mlet* %store-monad ((image (run-install %raid-root-os
%raid-root-os-source
#:script
%raid-root-installation-script
#:target-size (* 1300 MiB)))
(command (qemu-command/writable-image image)))
(run-basic-test %raid-root-os
`(,@command) "raid-root-os")))))
;;;
;;; LUKS-encrypted root file system.