From 1fb75128a5202b406622da6272bc809c46d1f439 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 25 Sep 2021 18:36:04 +0200 Subject: tests: Adjust to SRFI-64 as found in Guile 3.0.7. In Guile 3.0.7, 'test-runner-current' is set to #f upon 'test-end'. Consequently, the previous strategy, where we'd call 'test-runner-current' after 'test-end', no longer works. Instead, set the test runner in each test right before 'test-begin'. * gnu/build/marionette.scm (system-test-runner): New procedure. * gnu/tests/audio.scm (run-mpd-test): Replace (exit (= ...)) idiom by (test-runner-current (system-test-runner)). * gnu/tests/base.scm (run-basic-test) (run-cleanup-test, run-mcron-test, run-nss-mdns-test): Likewise. * gnu/tests/ci.scm (run-laminar-test): Likewise. * gnu/tests/cups.scm (run-cups-test): Likewise. * gnu/tests/databases.scm (run-memcached-test) (run-postgresql-test, run-mysql-test): Likewise. * gnu/tests/desktop.scm (run-elogind-test): Likewise. * gnu/tests/dict.scm (run-dicod-test): Likewise. * gnu/tests/docker.scm (run-docker-test): Likewise. (run-docker-system-test): Likewise. * gnu/tests/file-sharing.scm (run-transmission-daemon-test): Likewise. * gnu/tests/ganeti.scm (run-ganeti-test): Likewise. * gnu/tests/guix.scm (run-guix-build-coordinator-test): Likewise. (run-guix-data-service-test): Likewise. * gnu/tests/ldap.scm (run-ldap-test): Likewise. * gnu/tests/linux-modules.scm (run-loadable-kernel-modules-test-base): Likewise. * gnu/tests/mail.scm (run-opensmtpd-test) (run-exim-test, run-dovecot-test, run-getmail-test): Likewise. * gnu/tests/messaging.scm (run-xmpp-test) (run-bitlbee-test, run-quassel-test): Likewise. * gnu/tests/monitoring.scm (run-prometheus-node-exporter-server-test) (run-zabbix-server-test): Likewise. * gnu/tests/networking.scm (run-inetd-test, run-openvswitch-test) (run-dhcpd-test, run-tor-test, run-iptables-test, run-ipfs-test): Likewise. * gnu/tests/nfs.scm (run-nfs-test) (run-nfs-server-test, run-nfs-root-fs-test): Likewise. * gnu/tests/package-management.scm (run-nix-test): Likewise. * gnu/tests/reconfigure.scm (run-switch-to-system-test) (run-upgrade-services-test, run-install-bootloader-test): Likewise. * gnu/tests/rsync.scm (run-rsync-test): Likewise. * gnu/tests/security-token.scm (run-pcscd-test): Likewise. * gnu/tests/singularity.scm (run-singularity-test): Likewise. * gnu/tests/ssh.scm (run-ssh-test): Likewise. * gnu/tests/telephony.scm (run-jami-test): Likewise. * gnu/tests/version-control.scm (run-cgit-test): Likewise. (run-git-http-test, run-gitolite-test, run-gitile-test): Likewise. * gnu/tests/virtualization.scm (run-libvirt-test, run-childhurd-test): Likewise. * gnu/tests/web.scm (run-webserver-test, run-php-fpm-test) (run-hpcguix-web-server-test, run-tailon-test, run-patchwork-test): Likewise. --- gnu/tests/audio.scm | 4 ++-- gnu/tests/base.scm | 16 ++++++++-------- gnu/tests/ci.scm | 6 +++--- gnu/tests/cups.scm | 4 ++-- gnu/tests/databases.scm | 12 ++++++------ gnu/tests/desktop.scm | 6 +++--- gnu/tests/dict.scm | 6 +++--- gnu/tests/docker.scm | 8 ++++---- gnu/tests/file-sharing.scm | 4 ++-- gnu/tests/ganeti.scm | 4 ++-- gnu/tests/guix.scm | 8 ++++---- gnu/tests/ldap.scm | 4 ++-- gnu/tests/linux-modules.scm | 10 ++++++++-- gnu/tests/mail.scm | 18 +++++++++--------- gnu/tests/messaging.scm | 14 +++++++------- gnu/tests/monitoring.scm | 9 ++++----- gnu/tests/networking.scm | 24 ++++++++++++------------ gnu/tests/nfs.scm | 14 +++++++------- gnu/tests/package-management.scm | 5 ++--- gnu/tests/reconfigure.scm | 12 ++++++------ gnu/tests/rsync.scm | 4 ++-- gnu/tests/security-token.scm | 4 ++-- gnu/tests/singularity.scm | 6 +++--- gnu/tests/ssh.scm | 6 +++--- gnu/tests/telephony.scm | 4 ++-- gnu/tests/version-control.scm | 18 +++++++++--------- gnu/tests/virtualization.scm | 10 +++++----- gnu/tests/web.scm | 23 +++++++++++------------ 28 files changed, 133 insertions(+), 130 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/tests/audio.scm b/gnu/tests/audio.scm index 7bf7d4ef14..0124fa36a0 100644 --- a/gnu/tests/audio.scm +++ b/gnu/tests/audio.scm @@ -51,6 +51,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "mpd") (test-assert "service is running" @@ -70,8 +71,7 @@ (define marionette '(system* #$(file-append mpd-mpc "/bin/mpc")) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "mpd-test" test)) (define %test-mpd diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 9429a10b75..81be8de1cf 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -97,6 +97,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "basic") #$(and initialization @@ -505,8 +506,7 @@ (define (entry->list entry) "root@" #$(operating-system-host-name os)))))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation name test)) @@ -645,6 +645,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "cleanup") (test-assert "dirty service worked" @@ -657,8 +658,7 @@ (define marionette (scandir "/tmp")) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "cleanup" test)) @@ -716,6 +716,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "mcron") (test-assert "service running" @@ -752,8 +753,7 @@ (define marionette result) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation name test)) @@ -824,6 +824,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "avahi") (test-assert "nscd PID file is created" @@ -902,8 +903,7 @@ (define marionette (= (hostent:addrtype result) AF_INET))))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "nss-mdns" test)) diff --git a/gnu/tests/ci.scm b/gnu/tests/ci.scm index a8b39fcd01..b7970017fc 100644 --- a/gnu/tests/ci.scm +++ b/gnu/tests/ci.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017 Ludovic Courtès +;;; Copyright © 2017, 2021 Ludovic Courtès ;;; Copyright © 2017, 2018, 2019, 2020, 2021 Christopher Baines ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2018 Pierre-Antoine Rouby @@ -73,6 +73,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "laminar") (test-assert "service running" @@ -116,8 +117,7 @@ (define* (retry-on-error f #:key times delay) #:times 10 #:delay 5)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "laminar-test" test)) diff --git a/gnu/tests/cups.scm b/gnu/tests/cups.scm index 4e922e5023..fd6d87d2bf 100644 --- a/gnu/tests/cups.scm +++ b/gnu/tests/cups.scm @@ -57,6 +57,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "cups") ;; Wait for the web interface to become ready. @@ -80,8 +81,7 @@ (define marionette #:decode-body? #t))) (response-code response))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "cups-test" test)) diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index c8d11e10c0..ba2bb182b9 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -64,6 +64,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "memcached") ;; Wait for memcached to be up and running. @@ -115,8 +116,7 @@ (define marionette '(file-exists? "/var/log/memcached") marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "memcached-test" test)) @@ -182,6 +182,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "postgresql") (test-assert "service running" @@ -241,8 +242,7 @@ (define marionette (string-contains output "1"))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "postgresql-test" test)) @@ -286,6 +286,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "mysql") (test-assert "service running" @@ -341,8 +342,7 @@ (define marionette output)) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "mysql-test" test)) diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm index 6aa22fd49b..67e530d392 100644 --- a/gnu/tests/desktop.scm +++ b/gnu/tests/desktop.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017 Ludovic Courtès +;;; Copyright © 2017, 2021 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -46,6 +46,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "elogind") ;; Log in as root on tty1, and check what 'loginctl' returns. @@ -83,8 +84,7 @@ (define marionette (guest-file "/root/seats") (guest-file "/root/users"))))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "elogind" test)) diff --git a/gnu/tests/dict.scm b/gnu/tests/dict.scm index c50e3cd6da..51343be7de 100644 --- a/gnu/tests/dict.scm +++ b/gnu/tests/dict.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017, 2018 Ludovic Courtès +;;; Copyright © 2017, 2018, 2021 Ludovic Courtès ;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. @@ -82,6 +82,7 @@ (define %dico-socket (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "dicod") ;; Wait for the service to be started. @@ -117,8 +118,7 @@ (define %dico-socket (string-contains result "hello") result)))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "dicod" test)) diff --git a/gnu/tests/docker.scm b/gnu/tests/docker.scm index 92611b0a8d..45b5d375ea 100644 --- a/gnu/tests/docker.scm +++ b/gnu/tests/docker.scm @@ -79,6 +79,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "docker") (test-assert "service running" @@ -143,8 +144,7 @@ (define slurp (string->number response4)))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "docker-test" test)) @@ -224,6 +224,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "docker") (test-assert "service running" @@ -288,8 +289,7 @@ (define (wait-for-container-file container file) "status" "guix-daemon"))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "docker-system-test" test)) diff --git a/gnu/tests/file-sharing.scm b/gnu/tests/file-sharing.scm index 9a8ee6a593..7dd2a847f0 100644 --- a/gnu/tests/file-sharing.scm +++ b/gnu/tests/file-sharing.scm @@ -94,6 +94,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "transmission-daemon") ;; Make sure the "transmission" user and group have been created. @@ -259,8 +260,7 @@ (define marionette "--auth" auth-string "--session-info")))))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "transmission-daemon-test" test)) diff --git a/gnu/tests/ganeti.scm b/gnu/tests/ganeti.scm index b64a332dde..be70d1117a 100644 --- a/gnu/tests/ganeti.scm +++ b/gnu/tests/ganeti.scm @@ -120,6 +120,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "ganeti") ;; Ganeti uses the Shepherd to start/stop daemons, so make sure @@ -248,8 +249,7 @@ (define marionette "destroy" "--yes-do-it")) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 1))))) + (test-end)))) (gexp->derivation (string-append "ganeti-" hypervisor "-test") test)) diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm index af7d8f0b21..7e3bc8c1f5 100644 --- a/gnu/tests/guix.scm +++ b/gnu/tests/guix.scm @@ -77,6 +77,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "guix-build-coordinator") (test-assert "service running" @@ -99,8 +100,7 @@ (define marionette #:decode-body? #t))) (response-code response))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "guix-build-coordinator-test" test)) @@ -202,6 +202,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "guix-data-service") (test-assert "service running" @@ -235,8 +236,7 @@ (define marionette #:decode-body? #t))) (response-code response))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "guix-data-service-test" test)) diff --git a/gnu/tests/ldap.scm b/gnu/tests/ldap.scm index 197c1bfb28..e149972027 100644 --- a/gnu/tests/ldap.scm +++ b/gnu/tests/ldap.scm @@ -72,6 +72,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "ldap") ;; Set up LDAP directory server @@ -148,8 +149,7 @@ (define marionette #$(file-append coreutils "/bin/true"))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "ldap-test" test)) diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm index fc8945b77f..200c151008 100644 --- a/gnu/tests/linux-modules.scm +++ b/gnu/tests/linux-modules.scm @@ -76,23 +76,29 @@ (define os (marionette-operating-system base-os #:imported-modules '((guix combinators)))) + (define vm (virtual-machine os)) + (define (test script) (with-imported-modules '((gnu build marionette)) #~(begin (use-modules (gnu build marionette) (srfi srfi-64)) + (define marionette (make-marionette (list #$vm))) + (mkdir #$output) (chdir #$output) + + (test-runner-current (system-test-runner)) (test-begin "loadable-kernel-modules") (test-assert "script successfully evaluated" (marionette-eval '(primitive-load #$script) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) + (gexp->derivation "loadable-kernel-modules" (test (modules-loaded?-program os module-names)))) diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index eb8952b33a..ae6417c119 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Sou Bunnbu ;;; Copyright © 2017 Carlo Zancanaro -;;; Copyright © 2017, 2020 Ludovic Courtès +;;; Copyright © 2017, 2020, 2021 Ludovic Courtès ;;; Copyright © 2018 Oleg Pykhalov ;;; Copyright © 2018 Clément Lassieur ;;; Copyright © 2019 Christopher Baines @@ -88,6 +88,7 @@ (define (read-reply-code port) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "opensmptd") (test-assert "service is running" @@ -157,8 +158,7 @@ (define (queue-empty?) (sleep 1) (wait (- n 1)))))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "opensmtpd-test" test)) @@ -233,6 +233,7 @@ (define addr (make-socket-address AF_INET INADDR_LOOPBACK 1025)) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "exim") (test-assert "service is running" @@ -285,8 +286,7 @@ (define addr (make-socket-address AF_INET INADDR_LOOPBACK 1025)) (lambda (x) (not (string-prefix? "." x)))))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "exim-test" test)) @@ -341,6 +341,7 @@ (define message "From: test@example.com\n\ (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "dovecot") ;; Wait for dovecot to be up and running. @@ -399,8 +400,7 @@ (define message "From: test@example.com\n\ get-string-all))))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "dovecot-test" test)) @@ -492,6 +492,7 @@ (define message "From: test@example.com\n\ (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "getmail") ;; Wait for dovecot to be up and running. @@ -577,8 +578,7 @@ (define message "From: test@example.com\n\ marionette) message)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "getmail-test" test)) diff --git a/gnu/tests/messaging.scm b/gnu/tests/messaging.scm index 176e3d08cb..db9516a485 100644 --- a/gnu/tests/messaging.scm +++ b/gnu/tests/messaging.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2018 Clément Lassieur -;;; Copyright © 2017, 2018 Ludovic Courtès +;;; Copyright © 2017, 2018, 2021 Ludovic Courtès ;;; Copyright © 2018 Efraim Flashner ;;; ;;; This file is part of GNU Guix. @@ -101,6 +101,7 @@ (define (host-wait-for-file file) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "xmpp") ;; Wait for XMPP service to be up and running. @@ -128,8 +129,7 @@ (define (host-wait-for-file file) (system* freetalk-bin "-s" #$script.ft) (host-wait-for-file #$witness))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation name test)) @@ -194,6 +194,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "bitlbee") (test-assert "service started" @@ -231,8 +232,7 @@ (define marionette (->bool (string-contains (pk 'message (read-line sock)) "BitlBee")))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "bitlbee-test" test)) @@ -267,6 +267,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "quassel") (test-assert "service started" @@ -281,8 +282,7 @@ (define marionette '(file-exists? "/var/lib/quassel/quasselCert.pem") marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "quassel-test" test)) diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm index 8630f5818c..5039e22765 100644 --- a/gnu/tests/monitoring.scm +++ b/gnu/tests/monitoring.scm @@ -66,6 +66,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin #$name) (test-assert "prometheus-node-exporter running" @@ -87,8 +88,7 @@ (define marionette (http-get "http://localhost:8080"))) (response-code response)))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation (string-append name "-test") test)) @@ -168,6 +168,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin #$name) ;; XXX: Shepherd reads the config file *before* binding its control @@ -296,9 +297,7 @@ (define marionette (test-url "/") (test-url "/does-not-exist" 404)) - (test-end) - - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation (string-append name "-test") test)) diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm index 453e63f52d..fc2060b3ec 100644 --- a/gnu/tests/networking.scm +++ b/gnu/tests/networking.scm @@ -107,6 +107,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "inetd") ;; Make sure the PID file is created. @@ -137,8 +138,7 @@ (define marionette (close dict) response))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "inetd-test" test)) @@ -207,6 +207,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "openvswitch") ;; Make sure the bridge is created. @@ -244,8 +245,7 @@ (define marionette (current-services)))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "openvswitch-test" test)) @@ -307,6 +307,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "dhcpd") (test-assert "pid file exists" @@ -339,8 +340,7 @@ (define marionette (current-services)))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "dhcpd-test" test)) @@ -402,6 +402,7 @@ (define (tor-is-alive? marionette) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "tor") ;; Test the usual Tor service. @@ -433,8 +434,7 @@ (define (tor-is-alive? marionette) (wait-for-unix-socket "/var/run/tor/socks-sock" marionette/unix-socks-socket))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "tor-test" test)) @@ -529,6 +529,7 @@ (define (dump-iptables iptables-save marionette) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "iptables") (test-equal "iptables-save dumps the same rules that were loaded" @@ -557,8 +558,7 @@ (define (dump-iptables iptables-save marionette) ;; marionette) ;; (wait-for-tcp-port inetd-echo-port marionette #:timeout 5))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "iptables" test)) @@ -625,6 +625,7 @@ (define (read-contents object) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "ipfs") ;; Test the IPFS service. @@ -644,8 +645,7 @@ (define test-bv (string->utf8 "hello ipfs!")) test-bv (read-contents (add-data test-bv))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "ipfs-test" test)) (define %test-ipfs diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm index a0c091eadb..7b6aa51cac 100644 --- a/gnu/tests/nfs.scm +++ b/gnu/tests/nfs.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2020 Ludovic Courtès +;;; Copyright © 2016, 2017, 2020, 2021 Ludovic Courtès ;;; Copyright © 2016 John Darrington ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice @@ -95,6 +95,7 @@ (define (wait-for-socket file) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "rpc-daemon") ;; Wait for the rpcbind daemon to be up and running. @@ -130,8 +131,7 @@ (define (wait-for-socket file) '(zero? (system* "rpcinfo" "-p")) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation name test)) @@ -201,6 +201,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "nfs-daemon") (marionette-eval '(begin @@ -252,8 +253,7 @@ (define marionette "nfs-server:/" "/remote" "-v")) (file-exists? "/remote/hello"))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "nfs-server-test" test)) @@ -313,6 +313,7 @@ (define test (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "start-nfs-boot-test") ;;; Start up NFS server host. @@ -401,8 +402,7 @@ (define client-marionette (call-with-input-file "/export/mounts" display)) server-marionette) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "nfs-root-fs-test" test)) diff --git a/gnu/tests/package-management.scm b/gnu/tests/package-management.scm index 087eaf923e..7033f040dd 100644 --- a/gnu/tests/package-management.scm +++ b/gnu/tests/package-management.scm @@ -63,6 +63,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin #$name) ;; XXX: Shepherd reads the config file *before* binding its control @@ -105,9 +106,7 @@ (define marionette "guix-test.nix"))) marionette)) - (test-end) - - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation (string-append name "-test") test)) diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm index 001b5d185a..b97fedcf6b 100644 --- a/gnu/tests/reconfigure.scm +++ b/gnu/tests/reconfigure.scm @@ -82,6 +82,7 @@ (define (system-generations marionette) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "switch-to-system") (let ((generations-prior (system-generations marionette))) @@ -112,8 +113,7 @@ (define (system-generations marionette) "jakob") marionette))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "switch-to-system" (test (switch-system-program os)))) @@ -156,6 +156,7 @@ (define (running-services marionette) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "upgrade-services") (let ((services-prior (running-services marionette))) @@ -176,8 +177,7 @@ (define (running-services marionette) (test-assert "script stopped obsolete service" (not (memq 'dummy (running-services marionette))))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "upgrade-services" @@ -223,6 +223,7 @@ (define (generations-in-grub-cfg marionette) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "install-bootloader") (test-assert "no prior menu entry for system generation" @@ -236,8 +237,7 @@ (define (generations-in-grub-cfg marionette) (test-assert "menu entry created for system generation" (member #$os (generations-in-grub-cfg marionette))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (let* ((bootloader ((compose bootloader-configuration-bootloader operating-system-bootloader) diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm index 24e60d9d9d..2227edf30d 100644 --- a/gnu/tests/rsync.scm +++ b/gnu/tests/rsync.scm @@ -57,6 +57,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "rsync") ;; Wait for rsync to be up and running. @@ -106,8 +107,7 @@ (define marionette (read-line port)))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "rsync-test" test)) diff --git a/gnu/tests/security-token.scm b/gnu/tests/security-token.scm index 1169a4b9fd..d28d23a1ae 100644 --- a/gnu/tests/security-token.scm +++ b/gnu/tests/security-token.scm @@ -47,6 +47,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "pcscd") (test-assert "pcscd is alive" @@ -59,8 +60,7 @@ (define marionette (current-services)))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "pcscd" test)) diff --git a/gnu/tests/singularity.scm b/gnu/tests/singularity.scm index 1fc2773a00..ac2dec19b8 100644 --- a/gnu/tests/singularity.scm +++ b/gnu/tests/singularity.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2019 Ludovic Courtès +;;; Copyright © 2019, 2021 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -75,6 +75,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "singularity") (test-assert "singularity exec /bin/guile (as root)" @@ -126,8 +127,7 @@ (define marionette "--debug" "run" #$image "-c" "(use-modules (json))")) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "singularity-test" test)) diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm index 10438ad22a..7442bd1c2e 100644 --- a/gnu/tests/ssh.scm +++ b/gnu/tests/ssh.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2017 Marius Bakke ;;; @@ -111,6 +111,7 @@ (define (call-with-connected-session/auth proc) (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "ssh-daemon") ;; Wait for sshd to be up and running. @@ -209,8 +210,7 @@ (define (call-with-connected-session/auth proc) (channel-request-exec channel "path-witness") (zero? (channel-get-exit-status channel)))))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0)))))) + (test-end))))) (gexp->derivation name test)) diff --git a/gnu/tests/telephony.scm b/gnu/tests/telephony.scm index aeb6500c47..2d44d00165 100644 --- a/gnu/tests/telephony.scm +++ b/gnu/tests/telephony.scm @@ -141,6 +141,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "jami") (test-assert "service is running" @@ -341,8 +342,7 @@ (define new-pid (match (start-service 'jami) account-details))))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation (if provisioning? "jami-provisioning-test" diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm index a7cde1f163..c45c2d297c 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 -;;; Copyright © 2017, 2018, 2020 Ludovic Courtès +;;; Copyright © 2017, 2018, 2020, 2021 Ludovic Courtès ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2018 Christopher Baines ;;; @@ -135,6 +135,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "cgit") ;; XXX: Shepherd reads the config file *before* binding its control @@ -210,8 +211,7 @@ (define marionette (test-url "/test/tree/does-not-exist" 404) (test-url "/does-not-exist" 404)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "cgit-test" test)) @@ -273,6 +273,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "git-http") ;; Wait for nginx to be up and running. @@ -302,8 +303,7 @@ (define marionette (call-with-input-file "/tmp/clone/README" get-string-all))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "git-http" test)) @@ -370,6 +370,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "gitolite") ;; Wait for sshd to be up and running. @@ -410,8 +411,7 @@ (define marionette (test-assert "pushing, and the associated hooks" (invoke #$(file-append git "/bin/git") "push"))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "gitolite" test)) @@ -475,6 +475,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "gitile") ;; XXX: Shepherd reads the config file *before* binding its control @@ -540,8 +541,7 @@ (define marionette (test-url "/test/tree/-/does-not-exist" 404) (test-url "/does-not-exist" 404)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "gitile-test" test)) diff --git a/gnu/tests/virtualization.scm b/gnu/tests/virtualization.scm index 9f9d3a5e26..73f19db4e5 100644 --- a/gnu/tests/virtualization.scm +++ b/gnu/tests/virtualization.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Christopher Baines -;;; Copyright © 2020 Ludovic Courtès +;;; Copyright © 2020, 2021 Ludovic Courtès ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2021 Pierre Langlois ;;; @@ -76,6 +76,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "libvirt") (test-assert "service running" @@ -107,8 +108,7 @@ (define marionette "-c" "qemu:///system" "connect")) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "libvirt-test" test)) @@ -196,6 +196,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "childhurd") (test-assert "service running" @@ -250,8 +251,7 @@ (define marionette (open-input-pipe #$run-uname-over-ssh))) marionette)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "childhurd-test" test)) diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 518c9c1ff3..c9b6f17f07 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017, 2020 Ludovic Courtès +;;; Copyright © 2017, 2020, 2021 Ludovic Courtès ;;; Copyright © 2017, 2019 Christopher Baines ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2018 Pierre-Antoine Rouby @@ -116,6 +116,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin #$name) (test-assert #$(string-append name " service running") @@ -150,8 +151,7 @@ (define marionette marionette))) '()) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation (string-append name "-test") test)) @@ -312,6 +312,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "php-fpm") (test-assert "php-fpm running" @@ -350,9 +351,7 @@ (define marionette (and matches (match:substring matches 0)))))) - (test-end) - - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "php-fpm-test" test)) @@ -397,6 +396,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin #$name) (test-assert "hpcguix-web running" @@ -422,8 +422,7 @@ (define marionette #:times 10 #:delay 5))) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation (string-append name "-test") test)) @@ -489,6 +488,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "tailon") (test-assert "service running" @@ -512,8 +512,7 @@ (define marionette #:times 10 #:delay 5)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "tailon-test" test)) @@ -633,6 +632,7 @@ (define marionette (mkdir #$output) (chdir #$output) + (test-runner-current (system-test-runner)) (test-begin "patchwork") (test-assert "patchwork-postgresql-user-and-service started" @@ -667,8 +667,7 @@ (define marionette #:times 10 #:delay 5)) - (test-end) - (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + (test-end)))) (gexp->derivation "patchwork-test" test)) -- cgit v1.2.3