aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-10-26 18:48:32 +0100
committerChristopher Baines <mail@cbaines.net>2018-11-26 19:48:37 +0000
commit7eee5685f95d0b6baeb97f5fdd947fe5223a61c9 (patch)
tree45dc08eca5bfdde7b7854f6b2eb06508b6e645b3
parent176f1436c7af95eff6c8e63a0d0ba6922927a9da (diff)
downloadguix-btrfs-store-subvolume-test.tar
guix-btrfs-store-subvolume-test.tar.gz
WIP Btrfs store subvolume testbtrfs-store-subvolume-test
-rw-r--r--gnu/tests/install.scm91
1 files changed, 90 insertions, 1 deletions
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 4764ffffde..cfa071187c 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -43,7 +43,8 @@
%test-separate-home-os
%test-raid-root-os
%test-encrypted-os
- %test-btrfs-root-os))
+ %test-btrfs-root-os
+ %test-btrfs-root-with-store-subvolume-os))
;;; Commentary:
;;;
@@ -826,4 +827,92 @@ build (current-guix) and then store a couple of full system images.")
(command (qemu-command/writable-image image)))
(run-basic-test %btrfs-root-os command "btrfs-root-os")))))
+
+;;;
+;;; Btrfs root file system with store subvolume.
+;;;
+
+(define-os-with-source (%btrfs-root-with-store-subvolume-os
+ %btrfs-root-with-store-subvolume-os-source)
+ ;; The OS we want to install.
+ (use-modules (gnu) (gnu tests) (srfi srfi-1))
+
+ (operating-system
+ (host-name "liberigilo")
+ (timezone "Europe/Paris")
+ (locale "en_US.UTF-8")
+
+ (bootloader (bootloader-configuration
+ (bootloader grub-bootloader)
+ (target "/dev/vdb")))
+ (kernel-arguments '("console=ttyS0"))
+ (file-systems (cons* (file-system
+ (device (file-system-label "my-root"))
+ (mount-point "/")
+ (type "btrfs"))
+ (file-system
+ (device (file-system-label "my-root"))
+ (mount-point "/gnu/store")
+ (type "btrfs")
+ (options "subvol=/gnu/store"))
+ %base-file-systems))
+ (users (cons (user-account
+ (name "charlie")
+ (group "users")
+ (home-directory "/home/charlie")
+ (supplementary-groups '("wheel" "audio" "video")))
+ %base-user-accounts))
+ (services (cons (service marionette-service-type
+ (marionette-configuration
+ (imported-modules '((gnu services herd)
+ (guix combinators)))))
+ %base-services))))
+
+(define %btrfs-root-with-store-subvolume-installation-script
+ ;; Shell script of a simple installation.
+ "\
+. /etc/profile
+set -e -x
+guix --version
+
+export GUIX_BUILD_OPTIONS=--no-grafts
+ls -l /run/current-system/gc-roots
+parted --script /dev/vdb mklabel gpt \\
+ mkpart primary ext2 1M 3M \\
+ mkpart primary ext2 3M 2G \\
+ set 1 boot on \\
+ set 1 bios_grub on
+mkfs.btrfs -L my-root /dev/vdb2
+mount /dev/vdb2 /mnt
+btrfs subvolume create /mnt/home
+mkdir /mnt/gnu
+btrfs subvolume create /mnt/gnu/store
+herd start cow-store /mnt
+mkdir /mnt/etc
+cp /etc/target-config.scm /mnt/etc/config.scm
+guix system build /mnt/etc/config.scm
+guix system init /mnt/etc/config.scm /mnt --no-substitutes
+sync
+reboot\n")
+
+(define %test-btrfs-root-with-store-subvolume-os
+ (system-test
+ (name "btrfs-root-with-store-subvolume-os")
+ (description
+ "Test basic functionality of an OS installed like one would do by hand.
+This test is expensive in terms of CPU and storage usage since we need to
+build (current-guix) and then store a couple of full system images.")
+ (value
+ (mlet* %store-monad
+ ((image (run-install
+ %btrfs-root-with-store-subvolume-os
+ %btrfs-root-with-store-subvolume-os-source
+ #:script
+ %btrfs-root-with-store-subvolume-installation-script))
+
+ (command (qemu-command/writable-image image)))
+ (run-basic-test %btrfs-root-with-store-subvolume-os
+ command
+ "btrfs-root-with-store-subvolume-os")))))
+
;;; install.scm ends here