unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#40339] [PATCH] system: tests: Add a Btrfs RAID system test.
@ 2020-03-31  2:32 Maxim Cournoyer
  2020-11-21  9:48 ` Christopher Baines
  0 siblings, 1 reply; 3+ messages in thread
From: Maxim Cournoyer @ 2020-03-31  2:32 UTC (permalink / raw)
  To: 40339


[-- Attachment #1.1: Type: text/plain, Size: 169 bytes --]

Hello Guix!

This adds a system test validating that installing on a Btrfs RAID0
array works (and indeed, it does, without anything new to code -- how
refreshing :-)).


[-- Attachment #1.2: 0001-system-tests-Add-a-Btrfs-RAID-system-test.patch --]
[-- Type: text/x-patch, Size: 3854 bytes --]

From 024ba1459a9cdccffc87106b592dd98568ca1370 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Tue, 24 Mar 2020 12:45:10 -0400
Subject: [PATCH] system: tests: Add a Btrfs RAID system test.

* gnu/tests/install.scm (%btrfs-raid-root-os)
(%btrfs-raid-root-os-source, %btrfs-raid-root-installation-script)
(%test-btrfs-raid-root-os): New variables.
---
 gnu/tests/install.scm | 70 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index b0b40f2764..cf0b14eda0 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -57,6 +58,7 @@
             %test-raid-root-os
             %test-encrypted-root-os
             %test-btrfs-root-os
+            %test-btrfs-raid-root-os
             %test-jfs-root-os
 
             %test-gui-installed-os
@@ -849,6 +851,74 @@ 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")))))
 
+
+\f
+;;;
+;;; Btrfs RAID-0 root file system.
+;;;
+(define-os-with-source (%btrfs-raid-root-os %btrfs-raid-root-os-source)
+  ;; An OS whose root partition is a RAID partition.
+  (use-modules (gnu) (gnu tests))
+
+  (operating-system
+    (host-name "liberigilo")
+    (timezone "Europe/Paris")
+    (locale "en_US.utf8")
+
+    (bootloader (bootloader-configuration
+                 (bootloader grub-bootloader)
+                 (target "/dev/vdb")))
+    (kernel-arguments '("console=ttyS0"))
+
+    (file-systems (cons (file-system
+                          (device (file-system-label "root-fs"))
+                          (mount-point "/")
+                          (type "btrfs"))
+                        %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 %btrfs-raid-root-installation-script
+  "\
+. /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 1.4G \\
+  mkpart primary ext2 1.4G 2.8G \\
+  set 1 boot on \\
+  set 1 bios_grub on
+mkfs.btrfs -L root-fs -d raid0 -m raid0 /dev/vdb2 /dev/vdb3
+mount /dev/vdb2 /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-btrfs-raid-root-os
+  (system-test
+   (name "btrfs-raid-root-os")
+   (description "Test functionality of an OS installed with a Btrfs
+RAID-0 (stripe) root partition.")
+   (value
+    (mlet* %store-monad
+        ((image (run-install %btrfs-raid-root-os
+                             %btrfs-raid-root-os-source
+                             #:script %btrfs-raid-root-installation-script
+                             #:target-size (* 2800 MiB)))
+         (command (qemu-command/writable-image image)))
+      (run-basic-test %btrfs-raid-root-os `(,@command) "btrfs-raid-root-os")))))
+
 \f
 ;;;
 ;;; JFS root file system.
-- 
2.25.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-27 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31  2:32 [bug#40339] [PATCH] system: tests: Add a Btrfs RAID system test Maxim Cournoyer
2020-11-21  9:48 ` Christopher Baines
2021-01-27 16:39   ` bug#40339: " Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).