From 245cc5f5d55e8c0931a1a2d2becd78f9805de2df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 27 Oct 2016 13:46:43 +0200 Subject: 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. --- gnu/tests/install.scm | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'gnu') 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: @@ -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 + ;; 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. -- cgit v1.2.3