diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-10-27 13:46:43 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-10-27 13:48:52 +0200 |
commit | 245cc5f5d55e8c0931a1a2d2becd78f9805de2df (patch) | |
tree | 673ca5cd5a7b8981020a6da1ef5d3db55dda7c05 /gnu | |
parent | 49baaff4d2995cc4455843d7249894cb7456d8d5 (diff) | |
download | patches-245cc5f5d55e8c0931a1a2d2becd78f9805de2df.tar patches-245cc5f5d55e8c0931a1a2d2becd78f9805de2df.tar.gz |
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.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/tests/install.scm | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index b3908ec7b2..98f8649af8 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -34,6 +34,7 @@ #:use-module (guix utils) #:export (%test-installed-os %test-separate-store-os + %test-raid-root-os %test-encrypted-os)) ;;; Commentary: @@ -301,6 +302,89 @@ where /gnu lives on a separate partition.") ;;; +;;; 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. ;;; |