guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26339: [PATCH] tests: Add syslinux gpt test.


From: Mathieu Othacehe
Subject: bug#26339: [PATCH] tests: Add syslinux gpt test.
Date: Thu, 18 May 2017 12:26:18 +0200

* gnu/tests/install.scm (%test-installed-syslinux-os): New exported
  variable.
  (%minimal-syslinux-os, %minimal-syslinux-os-source): New variables.
  (%syslinux-gpt-installation-script): New variable.
* gnu/system/install.scm (installation-os)[packages]: Add syslinux.
---

Hi,

Here's a test installing a GuixSD system with extlinux-bootloader-gpt
as a bootloader.

I had to rewrite %minimal-syslinux-os as a copy of %minimal-os, but the only
change is the bootloader field. A better idea to avoid rewritting is welcome :)

Thanks,

Mathieu

 gnu/system/install.scm |  1 +
 gnu/tests/install.scm  | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 9a6febfeb..888998347 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -343,6 +343,7 @@ Use Alt-F2 for documentation.
     (packages (cons* (canonical-package glibc) ;for 'tzselect' & co.
                      parted gptfdisk ddrescue
                      grub                  ;mostly so xrefs to its manual work
+                     syslinux
                      cryptsetup
                      mdadm
                      dosfstools         ;mkfs.fat, for the UEFI boot partition
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index b104efcfd..9dcb41ba1 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -18,6 +18,7 @@
 
 (define-module (gnu tests install)
   #:use-module (gnu)
+  #:use-module (gnu bootloader extlinux)
   #:use-module (gnu tests)
   #:use-module (gnu tests base)
   #:use-module (gnu system)
@@ -34,6 +35,7 @@
   #:use-module (guix gexp)
   #:use-module (guix utils)
   #:export (%test-installed-os
+            %test-installed-syslinux-os
             %test-separate-store-os
             %test-separate-home-os
             %test-raid-root-os
@@ -77,6 +79,39 @@
                                                   (guix combinators)))))
                     %base-services))))
 
+(define-os-with-source (%minimal-syslinux-os
+                        %minimal-syslinux-os-source)
+  (use-modules (gnu) (gnu tests) (gnu bootloader extlinux)
+               (srfi srfi-1))
+
+  (operating-system
+    (host-name "liberigilo")
+    (timezone "Europe/Paris")
+    (locale "en_US.UTF-8")
+
+    (bootloader (bootloader-configuration
+                 (bootloader extlinux-bootloader-gpt)
+                 (device "/dev/vdb")))
+    (kernel-arguments '("console=ttyS0"))
+    (file-systems (cons (file-system
+                          (device "my-root")
+                          (title 'label)
+                          (mount-point "/")
+                          (type "ext4"))
+                        %base-file-systems))
+    (users (cons (user-account
+                  (name "alice")
+                  (comment "Bob's sister")
+                  (group "users")
+                  (supplementary-groups '("wheel" "audio" "video"))
+                  (home-directory "/home/alice"))
+                 %base-user-accounts))
+    (services (cons (service marionette-service-type
+                             (marionette-configuration
+                              (imported-modules '((gnu services herd)
+                                                  (guix combinators)))))
+                    %base-services))))
+
 (define (operating-system-with-current-guix os)
   "Return a variant of OS that uses the current Guix."
   (operating-system
@@ -121,6 +156,30 @@ guix system init /mnt/etc/config.scm /mnt --no-substitutes
 sync
 reboot\n")
 
+(define %syslinux-gpt-installation-script
+  ;; Shell script of a simple installation.
+  ;; As syslinux 6.0.3 does not handle 64bits ext4 partitions,
+  ;; we make sure to pass -O '^64bit' to mkfs.
+  "\
+. /etc/profile
+set -e -x
+guix --version
+
+export GUIX_BUILD_OPTIONS=--no-grafts
+guix build isc-dhcp
+parted --script /dev/vdb mklabel gpt \\
+  mkpart ext2 1M 1G \\
+  set 1 legacy_boot on
+mkfs.ext4 -L my-root -O '^64bit' /dev/vdb1
+mount /dev/vdb1 /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* (run-install target-os target-os-source
                       #:key
                       (script %simple-installation-script)
@@ -232,6 +291,20 @@ build (current-guix) and then store a couple of full 
system images.")
       (run-basic-test %minimal-os command
                       "installed-os")))))
 
+(define %test-installed-syslinux-os
+  (system-test
+   (name "installed-syslinux-os")
+   (description
+    "...")
+   (value
+    (mlet* %store-monad ((image (run-install %minimal-syslinux-os
+                                             %minimal-syslinux-os-source
+                                             #:script
+                                             
%syslinux-gpt-installation-script))
+                         (command (qemu-command/writable-image image)))
+      (run-basic-test %minimal-syslinux-os command
+                      "installed-syslinux-os")))))
+
 
 ;;;
 ;;; Separate /home.
-- 
2.13.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]