From: Christopher Baines <mail@cbaines.net>
To: 28288@debbugs.gnu.org
Subject: [bug#28288] [PATCH 5/5] tests: Add test for installing from an ISO Image.
Date: Sun, 3 Sep 2017 11:50:41 +0100 [thread overview]
Message-ID: <20170903105041.2925-5-mail@cbaines.net> (raw)
In-Reply-To: <20170903105041.2925-1-mail@cbaines.net>
* gnu/tests/install.scm (%test-iso-image-installer): New variable.
(run-install): Add #:installation-disk-image-file-system-type as a keyword
argument.
---
gnu/tests/install.scm | 110 +++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 99 insertions(+), 11 deletions(-)
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 866bf885c..93c8a89cd 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -37,6 +37,7 @@
#:use-module (guix utils)
#:export (%test-installed-os
%test-installed-extlinux-os
+ %test-iso-image-installer
%test-separate-store-os
%test-separate-home-os
%test-raid-root-os
@@ -196,6 +197,7 @@ reboot\n")
(kernel-arguments '("console=ttyS0")))
#:imported-modules '((gnu services herd)
(guix combinators))))
+ (installation-disk-image-file-system-type "ext4")
(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
@@ -213,7 +215,9 @@ packages defined in installation-os."
(image (system-disk-image
(operating-system-with-gc-roots
os (list target))
- #:disk-image-size (* 1500 MiB))))
+ #:disk-image-size (* 1500 MiB)
+ #:file-system-type
+ installation-disk-image-file-system-type)))
(define install
(with-imported-modules '((guix build utils)
(gnu build marionette))
@@ -229,16 +233,25 @@ packages defined in installation-os."
(define marionette
(make-marionette
- (cons (which #$(qemu-command system))
- (cons* "-no-reboot" "-m" "800"
- "-drive"
- (string-append "file=" #$image
- ",if=virtio,readonly")
- "-drive"
- (string-append "file=" #$output ",if=virtio")
- (if (file-exists? "/dev/kvm")
- '("-enable-kvm")
- '())))))
+ `(,(which #$(qemu-command system))
+ "-no-reboot"
+ "-m" "800"
+ #$@(cond
+ ((string=? "ext4" installation-disk-image-file-system-type)
+ `("-drive"
+ ,(file-append "file=" image
+ ",if=virtio,readonly")))
+ ((string=? "iso9660" installation-disk-image-file-system-type)
+ `("-cdrom" ,image))
+ (else
+ (error
+ "unsupported installation-disk-image-file-system-type:"
+ installation-disk-image-file-system-type)))
+ "-drive"
+ ,(string-append "file=" #$output ",if=virtio")
+ ,@(if (file-exists? "/dev/kvm")
+ '("-enable-kvm")
+ '()))))
(pk 'uname (marionette-eval '(uname) marionette))
@@ -313,6 +326,81 @@ per %test-installed-os, this test is expensive in terms of CPU and storage.")
"installed-extlinux-os")))))
\f
+;;;
+;;; Installation through an ISO image.
+;;;
+
+(define-os-with-source (%minimal-os-on-vda %minimal-os-on-vda-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 (grub-configuration (target "/dev/vda")))
+ (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 %simple-installation-script-for-/dev/vda
+ ;; Shell script of a simple installation.
+ "\
+. /etc/profile
+set -e -x
+guix --version
+
+export GUIX_BUILD_OPTIONS=--no-grafts
+guix build isc-dhcp
+parted --script /dev/vda mklabel gpt \\
+ mkpart primary ext2 1M 3M \\
+ mkpart primary ext2 3M 1G \\
+ set 1 boot on \\
+ set 1 bios_grub on
+mkfs.ext4 -L my-root /dev/vda2
+mount /dev/vda2 /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-iso-image-installer
+ (system-test
+ (name "iso-image-installer")
+ (description
+ "")
+ (value
+ (mlet* %store-monad ((image (run-install
+ %minimal-os-on-vda
+ %minimal-os-on-vda-source
+ #:script
+ %simple-installation-script-for-/dev/vda
+ #:installation-disk-image-file-system-type
+ "iso9660"))
+ (command (qemu-command/writable-image image)))
+ (run-basic-test %minimal-os-on-vda command name)))))
+
+\f
;;;
;;; Separate /home.
;;;
--
2.14.1
next prev parent reply other threads:[~2017-09-03 10:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-30 6:17 [bug#28288] [PATCH] Test and fix the ISO Image Installer Christopher Baines
2017-08-30 6:20 ` [bug#28288] [PATCH 1/2] tests: Add test for installing from an ISO Image Christopher Baines
2017-08-30 6:20 ` [bug#28288] [PATCH 2/2] WIP Christopher Baines
2017-08-30 6:31 ` Christopher Baines
2017-08-30 8:38 ` Danny Milosavljevic
2017-08-30 22:56 ` Christopher Baines
2017-08-31 13:04 ` Danny Milosavljevic
2017-08-31 21:47 ` Christopher Baines
2017-08-30 18:26 ` Danny Milosavljevic
2017-09-03 10:50 ` [bug#28288] [PATCH 1/5] vm: Add support for registering closures to make-iso9660-image Christopher Baines
2017-09-03 10:50 ` [bug#28288] [PATCH 2/5] vm: Create /mnt in the generated ISO image in make-iso9660-image Christopher Baines
2017-09-05 12:58 ` Danny Milosavljevic
2017-09-03 10:50 ` [bug#28288] [PATCH 3/5] vm: Add support for registering closures to iso9660-image Christopher Baines
2017-09-05 12:57 ` Danny Milosavljevic
2017-09-03 10:50 ` [bug#28288] [PATCH 4/5] vm: Call iso9660-image with #:register-closures? as #t Christopher Baines
2017-09-05 12:56 ` Danny Milosavljevic
2017-09-05 13:18 ` Ludovic Courtès
2017-09-03 10:50 ` Christopher Baines [this message]
2017-09-03 10:58 ` [bug#28288] [PATCH 5/5] tests: Add test for installing from an ISO Image Christopher Baines
2017-09-05 13:18 ` Ludovic Courtès
2017-09-06 7:46 ` bug#28288: " Christopher Baines
2017-09-05 13:17 ` [bug#28288] [PATCH 1/5] vm: Add support for registering closures to make-iso9660-image Ludovic Courtès
2017-09-06 7:05 ` Christopher Baines
2017-09-06 13:20 ` Ludovic Courtès
2017-09-10 10:45 ` Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170903105041.2925-5-mail@cbaines.net \
--to=mail@cbaines.net \
--cc=28288@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.