summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/audio.scm13
-rw-r--r--gnu/tests/base.scm2
-rw-r--r--gnu/tests/databases.scm49
-rw-r--r--gnu/tests/docker.scm11
-rw-r--r--gnu/tests/guix.scm1
-rw-r--r--gnu/tests/install.scm105
-rw-r--r--gnu/tests/mail.scm3
-rw-r--r--gnu/tests/monitoring.scm4
-rw-r--r--gnu/tests/nfs.scm2
-rw-r--r--gnu/tests/reconfigure.scm4
-rw-r--r--gnu/tests/version-control.scm6
-rw-r--r--gnu/tests/web.scm4
12 files changed, 184 insertions, 20 deletions
diff --git a/gnu/tests/audio.scm b/gnu/tests/audio.scm
index 8eadaf02e1..7bf7d4ef14 100644
--- a/gnu/tests/audio.scm
+++ b/gnu/tests/audio.scm
@@ -28,9 +28,7 @@
(define %mpd-os
(simple-operating-system
- (service mpd-service-type
- (mpd-configuration
- (user "root")))))
+ (service mpd-service-type)))
(define (run-mpd-test)
"Run tests in %mpd-os, which has mpd running."
@@ -62,9 +60,14 @@
(start-service 'mpd))
marionette))
- (test-assert "mpc connect"
+ (test-assert "mpd listening"
+ ;; Wait until mpd is actually listening before spawning 'mpc'.
+ (wait-for-tcp-port 6600 marionette))
+
+ (test-equal "mpc connect"
+ 0
(marionette-eval
- '(zero? (system #$(file-append mpd-mpc "/bin/mpc")))
+ '(system* #$(file-append mpd-mpc "/bin/mpc"))
marionette))
(test-end)
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 482310cc12..e5f9b87b1d 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -880,7 +880,7 @@ non-ASCII names from /tmp.")
(test-equal "avahi-browse"
0
(marionette-eval
- '(system* "avahi-browse" "-avt")
+ '(system* "/run/current-system/profile/bin/avahi-browse" "-avt")
marionette))
(test-assert "getaddrinfo .local"
diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm
index e0544bbcd2..31d5ae4c6a 100644
--- a/gnu/tests/databases.scm
+++ b/gnu/tests/databases.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -215,7 +216,9 @@
(define %postgresql-os
(simple-operating-system
- (service postgresql-service-type)))
+ (service postgresql-service-type
+ (postgresql-configuration
+ (postgresql postgresql-10)))))
(define (run-postgresql-test)
"Run tests in %POSTGRESQL-OS."
@@ -269,7 +272,7 @@
(define %mysql-os
(simple-operating-system
- (mysql-service)))
+ (service mysql-service-type)))
(define* (run-mysql-test)
"Run tests in %MYSQL-OS."
@@ -309,6 +312,48 @@
((pid) (number? pid))))))
marionette))
+ (test-assert "mysql_upgrade completed"
+ (wait-for-file "/var/lib/mysql/mysql_upgrade_info" marionette))
+
+ (test-eq "create database"
+ 0
+ (marionette-eval
+ '(begin
+ (system* #$(file-append mariadb "/bin/mysql")
+ "-e" "CREATE DATABASE guix;"))
+ marionette))
+
+ (test-eq "create table"
+ 0
+ (marionette-eval
+ '(begin
+ (system*
+ #$(file-append mariadb "/bin/mysql") "guix"
+ "-e" "CREATE TABLE facts (id INT, data VARCHAR(12));"))
+ marionette))
+
+ (test-eq "insert data"
+ 0
+ (marionette-eval
+ '(begin
+ (system* #$(file-append mariadb "/bin/mysql") "guix"
+ "-e" "INSERT INTO facts VALUES (1, 'awesome')"))
+ marionette))
+
+ (test-equal "retrieve data"
+ "awesome\n"
+ (marionette-eval
+ '(begin
+ (use-modules (ice-9 popen))
+ (let* ((port (open-pipe*
+ OPEN_READ
+ #$(file-append mariadb "/bin/mysql") "guix"
+ "-NB" "-e" "SELECT data FROM facts WHERE id=1;"))
+ (output (get-string-all port)))
+ (close-pipe port)
+ output))
+ marionette))
+
(test-end)
(exit (= (test-runner-fail-count (test-runner-current)) 0)))))
diff --git a/gnu/tests/docker.scm b/gnu/tests/docker.scm
index ea6c9a33fe..c70c3ddb9e 100644
--- a/gnu/tests/docker.scm
+++ b/gnu/tests/docker.scm
@@ -27,8 +27,9 @@
#:use-module (gnu services networking)
#:use-module (gnu services docker)
#:use-module (gnu services desktop)
- #:use-module (gnu packages docker)
+ #:use-module ((gnu packages base) #:select (glibc))
#:use-module (gnu packages guile)
+ #:use-module (gnu packages docker)
#:use-module (guix gexp)
#:use-module (guix grafts)
#:use-module (guix monads)
@@ -206,7 +207,7 @@ inside %DOCKER-OS."
;; load' must be able to store the whole image into memory, hence the
;; huge memory requirements. We should avoid the volatile-root setup
;; instead.
- (memory-size 3500)
+ (memory-size 4000)
(port-forwardings '())))
(define test
@@ -298,5 +299,9 @@ inside %DOCKER-OS."
(description "Run a system image as produced by @command{guix system
docker-image} inside Docker.")
(value (with-monad %store-monad
- (>>= (system-docker-image (simple-operating-system))
+ (>>= (system-docker-image (operating-system
+ (inherit (simple-operating-system))
+ ;; Use locales for a single libc to
+ ;; reduce space requirements.
+ (locale-libcs (list glibc))))
run-docker-system-test)))))
diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm
index 20b67d55d3..af7d8f0b21 100644
--- a/gnu/tests/guix.scm
+++ b/gnu/tests/guix.scm
@@ -156,6 +156,7 @@
(service dhcp-client-service-type)
(service postgresql-service-type
(postgresql-configuration
+ (postgresql postgresql-10)
(config-file
(postgresql-config-file
(hba-file
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 86bd93966b..71caa3a493 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -67,6 +67,7 @@
%test-btrfs-root-on-subvolume-os
%test-jfs-root-os
%test-f2fs-root-os
+ %test-lvm-separate-home-os
%test-gui-installed-os
%test-gui-installed-os-encrypted
@@ -798,6 +799,92 @@ build (current-guix) and then store a couple of full system images.")
;;;
+;;; Separate /home on LVM
+;;;
+
+;; Since LVM support in guix currently doesn't allow root-on-LVM we use /home on LVM
+(define-os-with-source (%lvm-separate-home-os %lvm-separate-home-os-source)
+ (use-modules (gnu) (gnu tests))
+
+ (operating-system
+ (host-name "separate-home-on-lvm")
+ (timezone "Europe/Paris")
+ (locale "en_US.utf8")
+
+ (bootloader (bootloader-configuration
+ (bootloader grub-bootloader)
+ (target "/dev/vdb")))
+ (kernel-arguments '("console=ttyS0"))
+
+ (mapped-devices (list (mapped-device
+ (source "vg0")
+ (target "vg0-home")
+ (type lvm-device-mapping))))
+ (file-systems (cons* (file-system
+ (device (file-system-label "root-fs"))
+ (mount-point "/")
+ (type "ext4"))
+ (file-system
+ (device "/dev/mapper/vg0-home")
+ (mount-point "/home")
+ (type "ext4")
+ (dependencies mapped-devices))
+ %base-file-systems))
+ (users %base-user-accounts)
+ (services (cons (service marionette-service-type
+ (marionette-configuration
+ (imported-modules '((gnu services herd)
+ (guix combinators)))))
+ %base-services))))
+
+(define %lvm-separate-home-installation-script
+ "\
+. /etc/profile
+set -e -x
+guix --version
+
+export GUIX_BUILD_OPTIONS=--no-grafts
+parted --script /dev/vdb mklabel gpt \\
+ mkpart primary ext2 1M 3M \\
+ mkpart primary ext2 3M 1.6G \\
+ mkpart primary 1.6G 3.2G \\
+ set 1 boot on \\
+ set 1 bios_grub on
+pvcreate /dev/vdb3
+vgcreate vg0 /dev/vdb3
+lvcreate -L 1.6G -n home vg0
+vgchange -ay
+mkfs.ext4 -L root-fs /dev/vdb2
+mkfs.ext4 /dev/mapper/vg0-home
+mount /dev/vdb2 /mnt
+mkdir /mnt/home
+mount /dev/mapper/vg0-home /mnt/home
+df -h /mnt /mnt/home
+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-lvm-separate-home-os
+ (system-test
+ (name "lvm-separate-home-os")
+ (description
+ "Test functionality of an OS installed with a LVM /home partition")
+ (value
+ (mlet* %store-monad ((image (run-install %lvm-separate-home-os
+ %lvm-separate-home-os-source
+ #:script
+ %lvm-separate-home-installation-script
+ #:packages (list lvm2-static)
+ #:target-size (* 3200 MiB)))
+ (command (qemu-command/writable-image image)))
+ (run-basic-test %lvm-separate-home-os
+ `(,@command) "lvm-separate-home-os")))))
+
+
+;;;
;;; Btrfs root file system.
;;;
@@ -1211,6 +1298,16 @@ build (current-guix) and then store a couple of full system images.")
#$marionette)
(screenshot "installer-run.ppm")
+ (unless #$encrypted?
+ ;; At this point, user partitions are formatted and the installer is
+ ;; waiting for us to start the final step: generating the
+ ;; configuration file, etc. Set a fixed UUID on the swap partition
+ ;; that matches what 'installation-target-os-for-gui-tests' expects.
+ (marionette-eval* '(invoke #$(file-append util-linux "/sbin/swaplabel")
+ "-U" "11111111-2222-3333-4444-123456789abc"
+ "/dev/vda2")
+ #$marionette))
+
(marionette-eval* '(conclude-installation installer-socket)
#$marionette)
@@ -1257,8 +1354,12 @@ build (current-guix) and then store a couple of full system images.")
'("wheel" "audio" "video"))))
%base-user-accounts))
;; The installer does not create a swap device in guided mode with
- ;; encryption support.
- (swap-devices (if encrypted? '() '("/dev/vda2")))
+ ;; encryption support. The installer produces a UUID for the partition;
+ ;; this "UUID" is explicitly set in 'gui-test-program' to the value shown
+ ;; below.
+ (swap-devices (if encrypted?
+ '()
+ (list (uuid "11111111-2222-3333-4444-123456789abc"))))
(services (cons (service dhcp-client-service-type)
(operating-system-user-services %minimal-os-on-vda)))))
diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm
index a50fb1dbca..eb8952b33a 100644
--- a/gnu/tests/mail.scm
+++ b/gnu/tests/mail.scm
@@ -205,8 +205,7 @@ acl_check_data:
(port-forwardings '((1025 . 25)))))
(define test
- (with-imported-modules '((gnu build marionette)
- (ice-9 ftw))
+ (with-imported-modules '((gnu build marionette))
#~(begin
(use-modules (rnrs base)
(srfi srfi-64)
diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm
index d20b8ac59e..7371b02fe1 100644
--- a/gnu/tests/monitoring.scm
+++ b/gnu/tests/monitoring.scm
@@ -307,7 +307,9 @@ zabbix||{}
(let ((base-os
(simple-operating-system
(service dhcp-client-service-type)
- (postgresql-service)
+ (service postgresql-service-type
+ (postgresql-configuration
+ (postgresql postgresql-10)))
(service zabbix-front-end-service-type
(zabbix-front-end-configuration
(db-password "zabbix")))
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index da729ddcc9..5d04af38fb 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -404,7 +404,7 @@ directories can be mounted.")
(test-end)
(exit (= (test-runner-fail-count (test-runner-current)) 0)))))
- (gexp->derivation "nfs-server-test" test))
+ (gexp->derivation "nfs-root-fs-test" test))
(define %test-nfs-root-fs
(system-test
diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm
index 928a210a94..52beeef447 100644
--- a/gnu/tests/reconfigure.scm
+++ b/gnu/tests/reconfigure.scm
@@ -260,7 +260,9 @@ bootloader's configuration file."
;; test suite, the bootloader installer script is omitted. 'grub-install'
;; would attempt to write directly to the virtual disk if the
;; installation script were run.
- (test (install-bootloader-program #f #f bootcfg bootcfg-file #f "/")))))
+ (test
+ (install-bootloader-program #f #f #f bootcfg bootcfg-file #f "/")))))
+
(define %test-switch-to-system
(system-test
diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm
index 230aa9edf9..d3cf19c913 100644
--- a/gnu/tests/version-control.scm
+++ b/gnu/tests/version-control.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com>
-;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2018 Christopher Baines <mail@cbaines.net>
;;;
@@ -285,6 +285,10 @@ HTTP-PORT."
'(file-exists? "/srv/git/test")
marionette))
+ (test-assert "fcgiwrap listens"
+ ;; Wait for fcgiwrap to be ready before cloning.
+ (wait-for-tcp-port 9000 marionette))
+
;; Make sure we can clone the repo from the host.
(test-equal "clone"
'#$README-contents
diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm
index 7513eab2e4..7f4518acd2 100644
--- a/gnu/tests/web.scm
+++ b/gnu/tests/web.scm
@@ -567,7 +567,9 @@ HTTP-PORT."
(config
(httpd-config-file
(listen '("8080"))))))
- (service postgresql-service-type)
+ (service postgresql-service-type
+ (postgresql-configuration
+ (postgresql postgresql-10)))
(service patchwork-service-type
(patchwork-configuration
(patchwork patchwork)