From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMzy9-0000Ee-8K for guix-patches@gnu.org; Mon, 19 Jun 2017 12:56:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMzy6-0002BM-JG for guix-patches@gnu.org; Mon, 19 Jun 2017 12:56:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:53784) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dMzy6-0002BE-Dg for guix-patches@gnu.org; Mon, 19 Jun 2017 12:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dMzy6-00059u-12 for guix-patches@gnu.org; Mon, 19 Jun 2017 12:56:02 -0400 Subject: [bug#26339] [PATCH] tests: Add syslinux gpt test. Resent-Message-ID: References: <20170402134916.2871-1-m.othacehe@gmail.com> <20170518102618.24842-1-m.othacehe@gmail.com> <87mv9d3q62.fsf@gnu.org> From: Mathieu Othacehe In-reply-to: <87mv9d3q62.fsf@gnu.org> Date: Mon, 19 Jun 2017 18:55:04 +0200 Message-ID: <87lgonkjdj.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 26339@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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. Thanks, Mathieu --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-tests-Add-extlinux-gpt-test.patch >From 7cf07ec0e909d99030e2646db9fdfef09d655316 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe 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 variable. (%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 %test-separate-store-os %test-separate-home-os %test-raid-root-os @@ -77,6 +80,38 @@ (guix combinators))))) %base-services)))) +(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." (operating-system @@ -121,23 +156,51 @@ guix system init /mnt/etc/config.scm /mnt --no-substitutes sync reboot\n") +(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 +sync +reboot\n") + (define* (run-install target-os target-os-source #:key (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. (operating-system - (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 "installed-os"))))) +(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 + %extlinux-gpt-installation-script)) + (command (qemu-command/writable-image image))) + (run-basic-test %minimal-extlinux-os command + "installed-extlinux-os"))))) + ;;; ;;; Separate /home. -- 2.13.1 --=-=-=--