[Top][All Lists]

[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: Mon, 19 Jun 2017 18:55:04 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Hi Ludo,

> I don’t think we should provide ‘syslinux’ in the installation image.
> The image is already fat enough.

Yep you're right, I added it without really understanding why it has
necessary for the test to succeed.

Now I understand why, it's because the image has no network access, so
every package that will be needed further has to be specified. I add a
packages list to "run-install" to solve this issue.


>From 7cf07ec0e909d99030e2646db9fdfef09d655316 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <address@hidden>
Date: Thu, 18 May 2017 12:19:53 +0200
Subject: [PATCH] tests: Add extlinux gpt test.

* gnu/tests/install.scm (%test-installed-extlinux-os): New exported
  (%minimal-extlinux-os, %minimal-extlinux-os-source): New variables.
  (%extlinux-gpt-installation-script): New variable.
 gnu/tests/install.scm | 92 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 86 insertions(+), 6 deletions(-)

diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index b104efcfd..7c5d48104 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -18,12 +18,14 @@
 (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)
   #:use-module (gnu system install)
   #:use-module (gnu system vm)
   #:use-module ((gnu build vm) #:select (qemu-command))
+  #:use-module (gnu packages bootloaders)
   #:use-module (gnu packages ocr)
   #:use-module (gnu packages qemu)
   #:use-module (gnu packages package-management)
@@ -34,6 +36,7 @@
   #:use-module (guix gexp)
   #:use-module (guix utils)
   #:export (%test-installed-os
+            %test-installed-extlinux-os
@@ -77,6 +80,38 @@
                                                   (guix combinators)))))
+(define (operating-system-add-packages os packages)
+  "Append PACKAGES to OS packages list."
+  (operating-system
+    (inherit os)
+    (packages (append packages (operating-system-packages os)))))
+(define-os-with-source (%minimal-extlinux-os
+                        %minimal-extlinux-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))
+    (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."
@@ -121,23 +156,51 @@ guix system init /mnt/etc/config.scm /mnt --no-substitutes
+(define %extlinux-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
 (define* (run-install target-os target-os-source
                       (script %simple-installation-script)
+                      (packages '())
                       (os (marionette-operating-system
-                           ;; Since the image has no network access, use the
-                           ;; current Guix so the store items we need are in
-                           ;; the image.
-                             (inherit (operating-system-with-current-guix
-                                       installation-os))
+                             ;; Since the image has no network access, use the
+                             ;; current Guix so the store items we need are in
+                             ;; the image and add packages provided.
+                             (inherit (operating-system-add-packages
+                                       (operating-system-with-current-guix
+                                        installation-os)
+                                       packages))
                              (kernel-arguments '("console=ttyS0")))
                            #:imported-modules '((gnu services herd)
                                                 (guix combinators))))
                       (target-size (* 1200 MiB)))
   "Run SCRIPT (a shell script following the GuixSD installation procedure) in
 OS to install TARGET-OS.  Return a VM image of TARGET-SIZE bytes containing
-the installed system."
+the installed system.  The packages specified in PACKAGES will be appended to
+packages defined in installation-os."
   (mlet* %store-monad ((_      (set-grafting #f))
                        (system (current-system))
@@ -232,6 +295,23 @@ build (current-guix) and then store a couple of full 
system images.")
       (run-basic-test %minimal-os command
+(define %test-installed-extlinux-os
+  (system-test
+   (name "installed-extlinux-os")
+   (description
+    "Test basic functionality of an OS booted with an extlinux bootloader.  As
+per %test-installed-os, this test is expensive in terms of CPU and storage.")
+   (value
+    (mlet* %store-monad ((image (run-install %minimal-extlinux-os
+                                             %minimal-extlinux-os-source
+                                             #:packages
+                                             (list syslinux)
+                                             #:script
+                         (command (qemu-command/writable-image image)))
+      (run-basic-test %minimal-extlinux-os command
+                      "installed-extlinux-os")))))
 ;;; Separate /home.

reply via email to

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