diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2018-06-29 22:51:23 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2018-06-29 22:51:23 +0200 |
commit | f1728d43460e63b106dd446e70001d8e100eaf6d (patch) | |
tree | 9d211fabf9e200743be49e25d108d58ed88d2f60 /gnu/tests | |
parent | cda7f4bc8ecf331d623c7d37b01931a46830c648 (diff) | |
parent | 373cc3b74a6ad33fddf75c2d773a97b1775bda8e (diff) | |
download | guix-f1728d43460e63b106dd446e70001d8e100eaf6d.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/tests')
-rw-r--r-- | gnu/tests/admin.scm | 7 | ||||
-rw-r--r-- | gnu/tests/base.scm | 132 | ||||
-rw-r--r-- | gnu/tests/dict.scm | 7 | ||||
-rw-r--r-- | gnu/tests/mail.scm | 13 | ||||
-rw-r--r-- | gnu/tests/messaging.scm | 14 | ||||
-rw-r--r-- | gnu/tests/nfs.scm | 7 | ||||
-rw-r--r-- | gnu/tests/rsync.scm | 7 | ||||
-rw-r--r-- | gnu/tests/ssh.scm | 8 | ||||
-rw-r--r-- | gnu/tests/version-control.scm | 20 | ||||
-rw-r--r-- | gnu/tests/web.scm | 8 |
10 files changed, 141 insertions, 82 deletions
diff --git a/gnu/tests/admin.scm b/gnu/tests/admin.scm index 3c7deb5426..a5abbe9ad4 100644 --- a/gnu/tests/admin.scm +++ b/gnu/tests/admin.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -74,13 +75,11 @@ HTTP-PORT." (test-begin "tailon") - (test-eq "service running" - 'running! + (test-assert "service running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'tailon) - 'running!) + (start-service 'tailon)) marionette)) (define* (retry-on-error f #:key times delay) diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 3faeddef6c..4c24cf57f6 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,6 +30,8 @@ #:use-module (gnu services mcron) #:use-module (gnu services shepherd) #:use-module (gnu services networking) + #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages imagemagick) #:use-module (gnu packages ocr) #:use-module (gnu packages package-management) @@ -36,11 +39,13 @@ #:use-module (gnu packages tmux) #:use-module (guix gexp) #:use-module (guix store) + #:use-module (guix monads) #:use-module (guix packages) #:use-module (srfi srfi-1) #:export (run-basic-test %test-basic-os %test-halt + %test-cleanup %test-mcron %test-nss-mdns)) @@ -472,6 +477,72 @@ in a loop. See <http://bugs.gnu.org/26931>.") ;;; +;;; Cleanup of /tmp, /var/run, etc. +;;; + +(define %cleanup-os + (simple-operating-system + (simple-service 'dirty-things + boot-service-type + (let ((script (plain-file + "create-utf8-file.sh" + (string-append + "echo $0: dirtying /tmp...\n" + "set -e; set -x\n" + "touch /witness\n" + "exec touch /tmp/λαμβδα")))) + (with-imported-modules '((guix build utils)) + #~(begin + (setenv "PATH" + #$(file-append coreutils "/bin")) + (invoke #$(file-append bash "/bin/sh") + #$script))))))) + +(define (run-cleanup-test name) + (define os + (marionette-operating-system %cleanup-os + #:imported-modules '((gnu services herd) + (guix combinators)))) + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64) + (ice-9 match)) + + (define marionette + (make-marionette (list #$(virtual-machine os)))) + + (mkdir #$output) + (chdir #$output) + + (test-begin "cleanup") + + (test-assert "dirty service worked" + (marionette-eval '(file-exists? "/witness") marionette)) + + (test-equal "/tmp cleaned up" + '("." "..") + (marionette-eval '(begin + (use-modules (ice-9 ftw)) + (scandir "/tmp")) + marionette)) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "cleanup" test)) + +(define %test-cleanup + ;; See <https://bugs.gnu.org/26353>. + (system-test + (name "cleanup") + (description "Make sure the 'cleanup' service can remove files with +non-ASCII names from /tmp.") + (value (run-cleanup-test name)))) + + +;;; ;;; Mcron. ;;; @@ -517,13 +588,11 @@ in a loop. See <http://bugs.gnu.org/26931>.") (test-begin "mcron") - (test-eq "service running" - 'running! + (test-assert "service running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'mcron) - 'running!) + (start-service 'mcron)) marionette)) ;; Make sure root's mcron job runs, has its cwd set to "/root", and @@ -619,32 +688,43 @@ in a loop. See <http://bugs.gnu.org/26931>.") (test-begin "avahi") - (test-assert "wait for services" + (test-assert "nscd PID file is created" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'nscd)) + marionette)) + + (test-assert "nscd is listening on its socket" + (marionette-eval + ;; XXX: Work around a race condition in nscd: nscd creates its + ;; PID file before it is listening on its socket. + '(let ((sock (socket PF_UNIX SOCK_STREAM 0))) + (let try () + (catch 'system-error + (lambda () + (connect sock AF_UNIX "/var/run/nscd/socket") + (close-port sock) + (format #t "nscd is ready~%") + #t) + (lambda args + (format #t "waiting for nscd...~%") + (usleep 500000) + (try))))) + marionette)) + + (test-assert "avahi is running" (marionette-eval '(begin (use-modules (gnu services herd)) + (start-service 'avahi-daemon)) + marionette)) - (start-service 'nscd) - - ;; XXX: Work around a race condition in nscd: nscd creates its - ;; PID file before it is listening on its socket. - (let ((sock (socket PF_UNIX SOCK_STREAM 0))) - (let try () - (catch 'system-error - (lambda () - (connect sock AF_UNIX "/var/run/nscd/socket") - (close-port sock) - (format #t "nscd is ready~%")) - (lambda args - (format #t "waiting for nscd...~%") - (usleep 500000) - (try))))) - - ;; Wait for the other useful things. - (start-service 'avahi-daemon) - (start-service 'networking) - - #t) + (test-assert "network is up" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'networking)) marionette)) (test-equal "avahi-resolve-host-name" diff --git a/gnu/tests/dict.scm b/gnu/tests/dict.scm index 4431e37dc1..dd60ffd464 100644 --- a/gnu/tests/dict.scm +++ b/gnu/tests/dict.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -84,13 +85,11 @@ (test-begin "dicod") ;; Wait for the service to be started. - (test-eq "service is running" - 'running! + (test-assert "service is running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'dicod) - 'running!) + (start-service 'dicod)) marionette)) ;; Wait until dicod is actually listening. diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 4de13b8684..5677969fac 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au> ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -84,8 +85,7 @@ accept from any for local deliver to mbox (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'smtpd) - #t) + (start-service 'smtpd)) marionette)) (test-assert "mbox is empty" @@ -224,8 +224,7 @@ acl_check_data: (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'exim) - #t) + (start-service 'exim)) marionette)) (sleep 1) ;; give the service time to start talking @@ -330,13 +329,11 @@ Subject: Hello Nice to meet you!") (test-begin "dovecot") ;; Wait for dovecot to be up and running. - (test-eq "dovecot running" - 'running! + (test-assert "dovecot running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'dovecot) - 'running!) + (start-service 'dovecot)) marionette)) ;; Check Dovecot service's PID. diff --git a/gnu/tests/messaging.scm b/gnu/tests/messaging.scm index f17dfe6265..f5f99b9f56 100644 --- a/gnu/tests/messaging.scm +++ b/gnu/tests/messaging.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org> +;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. @@ -102,13 +102,11 @@ (test-begin "xmpp") ;; Wait for XMPP service to be up and running. - (test-eq "service running" - 'running! + (test-assert "service running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'xmpp-daemon) - 'running!) + (start-service 'xmpp-daemon)) marionette)) ;; Check XMPP service's PID. @@ -196,13 +194,11 @@ (test-begin "bitlbee") - (test-eq "service started" - 'running! + (test-assert "service started" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'bitlbee) - 'running!) + (start-service 'bitlbee)) marionette)) (test-equal "valid PID" diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm index d58cf7aefd..140f03779b 100644 --- a/gnu/tests/nfs.scm +++ b/gnu/tests/nfs.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2016 John Darrington <jmd@gnu.org> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -94,13 +95,11 @@ (test-begin "rpc-daemon") ;; Wait for the rpcbind daemon to be up and running. - (test-eq "RPC service running" - 'running! + (test-assert "RPC service running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'rpcbind-daemon) - 'running!) + (start-service 'rpcbind-daemon)) marionette)) ;; Check the socket file and that the service is still running. diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm index c97836788b..a6f8fa2bd1 100644 --- a/gnu/tests/rsync.scm +++ b/gnu/tests/rsync.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -59,13 +60,11 @@ PORT." (test-begin "rsync") ;; Wait for rsync to be up and running. - (test-eq "service running" - 'running! + (test-assert "service running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'rsync) - 'running!) + (start-service 'rsync)) marionette)) ;; Make sure the PID file is created. diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm index 9247a43e6d..2e40122add 100644 --- a/gnu/tests/ssh.scm +++ b/gnu/tests/ssh.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> -;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org> +;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> ;;; ;;; This file is part of GNU Guix. @@ -111,13 +111,11 @@ root with an empty password." (test-begin "ssh-daemon") ;; Wait for sshd to be up and running. - (test-eq "service running" - 'running! + (test-assert "service running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'ssh-daemon) - 'running!) + (start-service 'ssh-daemon)) marionette)) ;; Check sshd's PID file. diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm index 8024739734..3b935a1b48 100644 --- a/gnu/tests/version-control.scm +++ b/gnu/tests/version-control.scm @@ -1,7 +1,7 @@ ;;; 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 Clément Lassieur <clement@lassieur.org> +;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -147,23 +147,19 @@ HTTP-PORT." marionette)) ;; Wait for nginx to be up and running. - (test-eq "nginx running" - 'running! + (test-assert "nginx running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'nginx) - 'running!) + (start-service 'nginx)) marionette)) ;; Wait for fcgiwrap to be up and running. - (test-eq "fcgiwrap running" - 'running! + (test-assert "fcgiwrap running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'fcgiwrap) - 'running!) + (start-service 'fcgiwrap)) marionette)) ;; Make sure the PID file is created. @@ -272,13 +268,11 @@ HTTP-PORT." (test-begin "git-http") ;; Wait for nginx to be up and running. - (test-eq "nginx running" - 'running! + (test-assert "nginx running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'nginx) - 'running!) + (start-service 'nginx)) marionette)) ;; Make sure Git test repository is created. diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index a6bf6efcfe..73d502dd0e 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> -;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org> +;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr> ;;; ;;; This file is part of GNU Guix. @@ -245,13 +245,11 @@ HTTP-PORT, along with php-fpm." ((pid) (number? pid)))))) marionette)) - (test-eq "nginx running" - 'running! + (test-assert "nginx running" (marionette-eval '(begin (use-modules (gnu services herd)) - (start-service 'nginx) - 'running!) + (start-service 'nginx)) marionette)) (test-equal "http-get" |