summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/install.scm14
-rw-r--r--gnu/tests/nfs.scm2
-rw-r--r--gnu/tests/virtualization.scm95
3 files changed, 103 insertions, 8 deletions
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 22e4181ab1..866bf885ce 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -59,7 +59,7 @@
(timezone "Europe/Paris")
(locale "en_US.UTF-8")
- (bootloader (grub-configuration (device "/dev/vdb")))
+ (bootloader (grub-configuration (target "/dev/vdb")))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device "my-root")
@@ -98,7 +98,7 @@
(bootloader (bootloader-configuration
(bootloader extlinux-bootloader-gpt)
- (device "/dev/vdb")))
+ (target "/dev/vdb")))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device "my-root")
@@ -326,7 +326,7 @@ per %test-installed-os, this test is expensive in terms of CPU and storage.")
(timezone "Europe/Paris")
(locale "en_US.utf8")
- (bootloader (grub-configuration (device "/dev/vdb")))
+ (bootloader (grub-configuration (target "/dev/vdb")))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device "my-root")
@@ -384,7 +384,7 @@ partition. In particular, home directories must be correctly created (see
(timezone "Europe/Paris")
(locale "en_US.UTF-8")
- (bootloader (grub-configuration (device "/dev/vdb")))
+ (bootloader (grub-configuration (target "/dev/vdb")))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device "root-fs")
@@ -460,7 +460,7 @@ where /gnu lives on a separate partition.")
(timezone "Europe/Paris")
(locale "en_US.utf8")
- (bootloader (grub-configuration (device "/dev/vdb")))
+ (bootloader (grub-configuration (target "/dev/vdb")))
(kernel-arguments '("console=ttyS0"))
(initrd (lambda (file-systems . rest)
;; Add a kernel module for RAID-0 (aka. "stripe").
@@ -543,7 +543,7 @@ by 'mdadm'.")
(timezone "Europe/Paris")
(locale "en_US.UTF-8")
- (bootloader (grub-configuration (device "/dev/vdb")))
+ (bootloader (grub-configuration (target "/dev/vdb")))
;; Note: Do not pass "console=ttyS0" so we can use our passphrase prompt
;; detection logic in 'enter-luks-passphrase'.
@@ -670,7 +670,7 @@ build (current-guix) and then store a couple of full system images.")
(timezone "Europe/Paris")
(locale "en_US.UTF-8")
- (bootloader (grub-configuration (device "/dev/vdb")))
+ (bootloader (grub-configuration (target "/dev/vdb")))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device "my-root")
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index 2e666b2c08..889f578d01 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -41,7 +41,7 @@
(timezone "Europe/Berlin")
(locale "en_US.UTF-8")
- (bootloader (grub-configuration (device "/dev/sdX")))
+ (bootloader (grub-configuration (target "/dev/sdX")))
(file-systems %base-file-systems)
(users %base-user-accounts)
(packages (cons*
diff --git a/gnu/tests/virtualization.scm b/gnu/tests/virtualization.scm
new file mode 100644
index 0000000000..c2939355b2
--- /dev/null
+++ b/gnu/tests/virtualization.scm
@@ -0,0 +1,95 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu tests virtualization)
+ #:use-module (gnu tests)
+ #:use-module (gnu system)
+ #:use-module (gnu system file-systems)
+ #:use-module (gnu system vm)
+ #:use-module (gnu services)
+ #:use-module (gnu services dbus)
+ #:use-module (gnu services networking)
+ #:use-module (gnu services virtualization)
+ #:use-module (gnu packages virtualization)
+ #:use-module (guix gexp)
+ #:use-module (guix store)
+ #:export (%test-libvirt))
+
+(define %libvirt-os
+ (simple-operating-system
+ (dhcp-client-service)
+ (dbus-service)
+ (polkit-service)
+ (service libvirt-service-type)))
+
+(define (run-libvirt-test)
+ "Run tests in %LIBVIRT-OS."
+ (define os
+ (marionette-operating-system
+ %libvirt-os
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+
+ (define vm
+ (virtual-machine
+ (operating-system os)
+ (port-forwardings '())))
+
+ (define test
+ (with-imported-modules '((gnu build marionette))
+ #~(begin
+ (use-modules (srfi srfi-11) (srfi srfi-64)
+ (gnu build marionette))
+
+ (define marionette
+ (make-marionette (list #$vm)))
+
+ (mkdir #$output)
+ (chdir #$output)
+
+ (test-begin "libvirt")
+
+ (test-assert "service running"
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+ (match (start-service 'libvirtd)
+ (#f #f)
+ (('service response-parts ...)
+ (match (assq-ref response-parts 'running)
+ ((pid) (number? pid))))))
+ marionette))
+
+ (test-eq "fetch version"
+ 0
+ (marionette-eval
+ `(begin
+ (system* ,(string-append #$libvirt "/bin/virsh")
+ "-c" "qemu:///system" "version"))
+ marionette))
+
+ (test-end)
+ (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+ (gexp->derivation "libvirt-test" test))
+
+(define %test-libvirt
+ (system-test
+ (name "libvirt")
+ (description "Connect to the running LIBVIRT service.")
+ (value (run-libvirt-test))))