From unknown Sat Jun 14 19:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 11 Jun 2018 22:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 31788 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 31788@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.152875474224385 (code B ref -1); Mon, 11 Jun 2018 22:06:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jun 2018 22:05:42 +0000 Received: from localhost ([127.0.0.1]:43759 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSUwS-0006L5-6O for submit@debbugs.gnu.org; Mon, 11 Jun 2018 18:05:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38803) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSUwP-0006Ks-KO for submit@debbugs.gnu.org; Mon, 11 Jun 2018 18:05:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSUwH-0006JL-N0 for submit@debbugs.gnu.org; Mon, 11 Jun 2018 18:05:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43857) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSUwH-0006J2-H1 for submit@debbugs.gnu.org; Mon, 11 Jun 2018 18:05:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSUwF-0004DJ-7u for guix-patches@gnu.org; Mon, 11 Jun 2018 18:05:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSUwB-0006Fo-RD for guix-patches@gnu.org; Mon, 11 Jun 2018 18:05:23 -0400 Received: from mail.lassieur.org ([83.152.10.219]:49578) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSUwB-0006E3-5x for guix-patches@gnu.org; Mon, 11 Jun 2018 18:05:19 -0400 Received: from localhost.localdomain (88.191.118.83 [88.191.118.83]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 12f1050a (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Mon, 11 Jun 2018 22:05:16 +0000 (UTC) From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Date: Tue, 12 Jun 2018 00:05:08 +0200 Message-Id: <20180611220508.17320-1-clement@lassieur.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Since commit dc7b3e56337ee9d8dcd8fe7d5cab71ef536d024f, 'start-service' returns the Shepherd's representation of the service as a sexp, and '#f' if the service fails to start. Also, it doesn't throw an exception when the service fails to start, so relying on an exception instead of relying on its return value is a false positive. * gnu/tests/base.scm (run-nss-mdns-test): Split tests so to check the return value of 'start-service'. (run-mcron-test, run-nss-mdns-test): Use 'test-assert' with the return value of 'start-service'. * gnu/tests/admin.scm (run-tailon-test): Idem. * gnu/tests/dict.scm (run-dicod-test): Idem. * gnu/tests/mail.scm (run-opensmtpd-test, run-exim-test, run-dovecot-test): Idem. * gnu/tests/messaging.scm (run-xmpp-test, run-bitlbee-test): Idem. * gnu/tests/nfs.scm (run-nfs-test): Idem. * gnu/tests/rsync.scm (run-rsync-test): Idem. * gnu/tests/ssh.scm (run-ssh-test): Idem. * gnu/tests/version-control.scm (run-cgit-test, run-git-http-test): Idem. * gnu/tests/web.scm (run-php-fpm-test): Idem. --- gnu/tests/admin.scm | 7 ++-- gnu/tests/base.scm | 62 ++++++++++++++++++++--------------- gnu/tests/dict.scm | 7 ++-- gnu/tests/mail.scm | 13 +++----- gnu/tests/messaging.scm | 14 +++----- gnu/tests/nfs.scm | 7 ++-- gnu/tests/rsync.scm | 7 ++-- gnu/tests/ssh.scm | 8 ++--- gnu/tests/version-control.scm | 20 ++++------- gnu/tests/web.scm | 8 ++--- 10 files changed, 71 insertions(+), 82 deletions(-) diff --git a/gnu/tests/admin.scm b/gnu/tests/admin.scm index 3c7deb542..a5abbe9ad 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 +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 3faeddef6..05c846264 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 +;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. ;;; @@ -517,13 +518,11 @@ in a loop. See .") (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 +618,43 @@ in a loop. See .") (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 4431e37dc..dd60ffd46 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 +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 4de13b868..5677969fa 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2017 Carlo Zancanaro ;;; Copyright © 2017 Ludovic Courtès ;;; Copyright © 2018 Oleg Pykhalov +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 f17dfe626..f5f99b9f5 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 +;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2017, 2018 Ludovic Courtès ;;; ;;; 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 d58cf7aef..140f03779 100644 --- a/gnu/tests/nfs.scm +++ b/gnu/tests/nfs.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2016 John Darrington ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 c97836788..a6f8fa2bd 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 +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 9247a43e6..2e40122ad 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 -;;; Copyright © 2017 Clément Lassieur +;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2017 Marius Bakke ;;; ;;; 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 802473973..3b935a1b4 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 ;;; Copyright © 2017, 2018 Ludovic Courtès -;;; Copyright © 2017 Clément Lassieur +;;; Copyright © 2017, 2018 Clément Lassieur ;;; ;;; 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 a6bf6efcf..73d502dd0 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 ;;; Copyright © 2017 Christopher Baines -;;; Copyright © 2017 Clément Lassieur +;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2018 Pierre-Antoine Rouby ;;; ;;; 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" -- 2.17.1 From unknown Sat Jun 14 19:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 12 Jun 2018 19:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31788 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 31788@debbugs.gnu.org Received: via spool by 31788-submit@debbugs.gnu.org id=B31788.15288327797310 (code B ref 31788); Tue, 12 Jun 2018 19:47:02 +0000 Received: (at 31788) by debbugs.gnu.org; 12 Jun 2018 19:46:19 +0000 Received: from localhost ([127.0.0.1]:45370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSpFB-0001sJ-RH for submit@debbugs.gnu.org; Tue, 12 Jun 2018 15:46:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSpF9-0001lu-RU for 31788@debbugs.gnu.org; Tue, 12 Jun 2018 15:46:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSpF3-0003Uv-JZ for 31788@debbugs.gnu.org; Tue, 12 Jun 2018 15:46:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSpF3-0003Up-FW; Tue, 12 Jun 2018 15:46:09 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35798 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fSpF2-00080g-SX; Tue, 12 Jun 2018 15:46:09 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180611220508.17320-1-clement@lassieur.org> Date: Tue, 12 Jun 2018 21:46:06 +0200 In-Reply-To: <20180611220508.17320-1-clement@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Tue, 12 Jun 2018 00:05:08 +0200") Message-ID: <87r2lbokjl.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Hi Cl=C3=A9ment, Cl=C3=A9ment Lassieur skribis: > Since commit dc7b3e56337ee9d8dcd8fe7d5cab71ef536d024f, 'start-service' re= turns > the Shepherd's representation of the service as a sexp, and '#f' if the > service fails to start. Also, it doesn't throw an exception when the ser= vice > fails to start, so relying on an exception instead of relying on its retu= rn > value is a false positive. Looking at =E2=80=98invoke-action=E2=80=99 (used by =E2=80=98start-service= =E2=80=99) in (gnu services herd), it seems that an exception is raised upon error: (('reply ('version 0 x ...) ('result y) ('error error) ('messages messages)) (for-each display-message messages) (raise-shepherd-error error) #f) There=E2=80=99s one case where an exception isn=E2=80=99t raised, and that= =E2=80=99s when shepherd returns something completely bogus: (x ;; invalid reply #f) Am I missing something? Thanks, Ludo=E2=80=99. From unknown Sat Jun 14 19:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 12 Jun 2018 20:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31788 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 31788@debbugs.gnu.org Received: via spool by 31788-submit@debbugs.gnu.org id=B31788.152883381019103 (code B ref 31788); Tue, 12 Jun 2018 20:04:01 +0000 Received: (at 31788) by debbugs.gnu.org; 12 Jun 2018 20:03:30 +0000 Received: from localhost ([127.0.0.1]:45379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSpVq-0004y2-2K for submit@debbugs.gnu.org; Tue, 12 Jun 2018 16:03:30 -0400 Received: from mail.lassieur.org ([83.152.10.219]:44820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSpVn-0004xt-Iz for 31788@debbugs.gnu.org; Tue, 12 Jun 2018 16:03:28 -0400 Received: from rodion (88.191.118.83 [88.191.118.83]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 48513127 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Tue, 12 Jun 2018 20:03:25 +0000 (UTC) References: <20180611220508.17320-1-clement@lassieur.org> <87r2lbokjl.fsf@gnu.org> User-agent: mu4e 1.0; emacs 26.1 From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: <87r2lbokjl.fsf@gnu.org> Date: Tue, 12 Jun 2018 22:03:24 +0200 Message-ID: <87y3fjhiwj.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludovic, Ludovic Court=C3=A8s writes: > Hi Cl=C3=A9ment, > > Cl=C3=A9ment Lassieur skribis: > >> Since commit dc7b3e56337ee9d8dcd8fe7d5cab71ef536d024f, 'start-service' r= eturns >> the Shepherd's representation of the service as a sexp, and '#f' if the >> service fails to start. Also, it doesn't throw an exception when the se= rvice >> fails to start, so relying on an exception instead of relying on its ret= urn >> value is a false positive. > > Looking at =E2=80=98invoke-action=E2=80=99 (used by =E2=80=98start-servic= e=E2=80=99) in (gnu services > herd), it seems that an exception is raised upon error: > > (('reply ('version 0 x ...) ('result y) ('error error) > ('messages messages)) > (for-each display-message messages) > (raise-shepherd-error error) > #f) But that's for Shepherd errors. When a service fails to start, it's not a Shepherd error, so if my understanding is correct '(cont result)' should be called. With result being '#f'. (match (read sock) (('reply ('version 0 _ ...) ('result result) ('error #f) ('messages messages)) (for-each display-message messages) (cont result)) (('reply ('version 0 x ...) ('result y) ('error error) ('messages messages)) (for-each display-message messages) (raise-shepherd-error error) #f) (x ;; invalid reply #f)) From unknown Sat Jun 14 19:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 12 Jun 2018 20:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31788 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 31788@debbugs.gnu.org Received: via spool by 31788-submit@debbugs.gnu.org id=B31788.152883592830012 (code B ref 31788); Tue, 12 Jun 2018 20:39:01 +0000 Received: (at 31788) by debbugs.gnu.org; 12 Jun 2018 20:38:48 +0000 Received: from localhost ([127.0.0.1]:45430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSq3z-0007nz-OG for submit@debbugs.gnu.org; Tue, 12 Jun 2018 16:38:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60547) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSq3y-0007nm-Gw for 31788@debbugs.gnu.org; Tue, 12 Jun 2018 16:38:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSq3s-0007GF-Fo for 31788@debbugs.gnu.org; Tue, 12 Jun 2018 16:38:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSq3s-0007G9-C4; Tue, 12 Jun 2018 16:38:40 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35842 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fSq3r-0002h8-TD; Tue, 12 Jun 2018 16:38:40 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180611220508.17320-1-clement@lassieur.org> <87r2lbokjl.fsf@gnu.org> <87y3fjhiwj.fsf@lassieur.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 Prairial an 226 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 12 Jun 2018 22:38:38 +0200 In-Reply-To: <87y3fjhiwj.fsf@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Tue, 12 Jun 2018 22:03:24 +0200") Message-ID: <877en3oi41.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Cl=C3=A9ment Lassieur skribis: > Ludovic Court=C3=A8s writes: > >> Hi Cl=C3=A9ment, >> >> Cl=C3=A9ment Lassieur skribis: >> >>> Since commit dc7b3e56337ee9d8dcd8fe7d5cab71ef536d024f, 'start-service' = returns >>> the Shepherd's representation of the service as a sexp, and '#f' if the >>> service fails to start. Also, it doesn't throw an exception when the s= ervice >>> fails to start, so relying on an exception instead of relying on its re= turn >>> value is a false positive. >> >> Looking at =E2=80=98invoke-action=E2=80=99 (used by =E2=80=98start-servi= ce=E2=80=99) in (gnu services >> herd), it seems that an exception is raised upon error: >> >> (('reply ('version 0 x ...) ('result y) ('error error) >> ('messages messages)) >> (for-each display-message messages) >> (raise-shepherd-error error) >> #f) > > But that's for Shepherd errors. When a service fails to start, it's not > a Shepherd error, so if my understanding is correct '(cont result)' > should be called. With result being '#f'. Oh, you=E2=80=99re right, sorry for the confusion. So on success =E2=80=98start-service=E2=80=99 returns a truth value, and we=E2=80=99re fi= ne. I=E2=80=99m not entirely sure about things like this: - (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)) =E2=80=98start-service=E2=80=99 in this case returns a number (the PID), an= d I think =E2=80=98test-assert=E2=80=99 reports a failure when the value is not exact= ly #t. Isn=E2=80=99t it the case? Ludo=E2=80=99. From unknown Sat Jun 14 19:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'. Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 12 Jun 2018 20:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31788 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 31788@debbugs.gnu.org Received: via spool by 31788-submit@debbugs.gnu.org id=B31788.152883666231132 (code B ref 31788); Tue, 12 Jun 2018 20:52:01 +0000 Received: (at 31788) by debbugs.gnu.org; 12 Jun 2018 20:51:02 +0000 Received: from localhost ([127.0.0.1]:45442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSqFq-00085u-66 for submit@debbugs.gnu.org; Tue, 12 Jun 2018 16:51:02 -0400 Received: from mail.lassieur.org ([83.152.10.219]:44828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSqFn-00085e-Pr for 31788@debbugs.gnu.org; Tue, 12 Jun 2018 16:51:00 -0400 Received: from rodion (88.191.118.83 [88.191.118.83]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id de88a2a1 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Tue, 12 Jun 2018 20:50:58 +0000 (UTC) References: <20180611220508.17320-1-clement@lassieur.org> <87r2lbokjl.fsf@gnu.org> <87y3fjhiwj.fsf@lassieur.org> <877en3oi41.fsf@gnu.org> User-agent: mu4e 1.0; emacs 26.1 From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: <877en3oi41.fsf@gnu.org> Date: Tue, 12 Jun 2018 22:50:57 +0200 Message-ID: <87tvq7u3ta.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ludovic Court=C3=A8s writes: > I=E2=80=99m not entirely sure about things like this: > > - (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)) > > =E2=80=98start-service=E2=80=99 in this case returns a number (the PID), = and I think > =E2=80=98test-assert=E2=80=99 reports a failure when the value is not exa= ctly #t. Isn=E2=80=99t > it the case? srfi-64 says: "The test passes if the result is true", so I believe test-assert reports a failure only when the value is #f (and maybe on exceptions), because anything else is true in Scheme. From unknown Sat Jun 14 19:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'. Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 13 Jun 2018 06:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31788 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 31788@debbugs.gnu.org Received: via spool by 31788-submit@debbugs.gnu.org id=B31788.15288726762527 (code B ref 31788); Wed, 13 Jun 2018 06:52:02 +0000 Received: (at 31788) by debbugs.gnu.org; 13 Jun 2018 06:51:16 +0000 Received: from localhost ([127.0.0.1]:45681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSzch-0000ef-Q4 for submit@debbugs.gnu.org; Wed, 13 Jun 2018 02:51:15 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSzcg-0000eA-Eu for 31788@debbugs.gnu.org; Wed, 13 Jun 2018 02:51:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSzcW-0002mm-FP for 31788@debbugs.gnu.org; Wed, 13 Jun 2018 02:51:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSzcW-0002mi-B2; Wed, 13 Jun 2018 02:51:04 -0400 Received: from [193.50.110.75] (port=38304 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fSzcV-0001Pm-Ot; Wed, 13 Jun 2018 02:51:04 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180611220508.17320-1-clement@lassieur.org> <87r2lbokjl.fsf@gnu.org> <87y3fjhiwj.fsf@lassieur.org> <877en3oi41.fsf@gnu.org> <87tvq7u3ta.fsf@lassieur.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 Prairial an 226 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 13 Jun 2018 08:51:01 +0200 In-Reply-To: <87tvq7u3ta.fsf@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Tue, 12 Jun 2018 22:50:57 +0200") Message-ID: <877en3p4bu.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Cl=C3=A9ment Lassieur skribis: > Ludovic Court=C3=A8s writes: > >> I=E2=80=99m not entirely sure about things like this: >> >> - (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)) >> >> =E2=80=98start-service=E2=80=99 in this case returns a number (the PID),= and I think >> =E2=80=98test-assert=E2=80=99 reports a failure when the value is not ex= actly #t. Isn=E2=80=99t >> it the case? > > srfi-64 says: "The test passes if the result is true", so I believe > test-assert reports a failure only when the value is #f (and maybe on > exceptions), because anything else is true in Scheme. Yeah I know; I had a vague recollection of SRFI-64 behaving funny but that=E2=80=99s no longer the case. So I guess you can go ahead. Thank you! Ludo=E2=80=99. From unknown Sat Jun 14 19:48:48 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Subject: bug#31788: closed (Re: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'.) Message-ID: References: <87r2lb6twh.fsf@lassieur.org> <20180611220508.17320-1-clement@lassieur.org> X-Gnu-PR-Message: they-closed 31788 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 31788@debbugs.gnu.org Date: Wed, 13 Jun 2018 07:14:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1528874042-4453-1" This is a multi-part message in MIME format... ------------=_1528874042-4453-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #31788: [PATCH] tests: Honor the return value of 'start-service'. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 31788@debbugs.gnu.org. --=20 31788: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D31788 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1528874042-4453-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 31788-done) by debbugs.gnu.org; 13 Jun 2018 07:13:40 +0000 Received: from localhost ([127.0.0.1]:45695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSzyN-000191-6n for submit@debbugs.gnu.org; Wed, 13 Jun 2018 03:13:40 -0400 Received: from mail.lassieur.org ([83.152.10.219]:44976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSzyK-00018s-UQ for 31788-done@debbugs.gnu.org; Wed, 13 Jun 2018 03:13:37 -0400 Received: from newt (smtp.parrot.biz [62.23.167.188]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 5e0a9040 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Wed, 13 Jun 2018 07:13:35 +0000 (UTC) References: <20180611220508.17320-1-clement@lassieur.org> <87r2lbokjl.fsf@gnu.org> <87y3fjhiwj.fsf@lassieur.org> <877en3oi41.fsf@gnu.org> <87tvq7u3ta.fsf@lassieur.org> <877en3p4bu.fsf@gnu.org> User-agent: mu4e 1.0; emacs 26.1 From: =?utf-8?Q?Cl=C3=A9ment?= Lassieur To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'. In-reply-to: <877en3p4bu.fsf@gnu.org> Date: Wed, 13 Jun 2018 09:13:34 +0200 Message-ID: <87r2lb6twh.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 31788-done Cc: 31788-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ludovic Court=C3=A8s writes: > Cl=C3=A9ment Lassieur skribis: > >> Ludovic Court=C3=A8s writes: >> >>> I=E2=80=99m not entirely sure about things like this: >>> >>> - (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)) >>> >>> =E2=80=98start-service=E2=80=99 in this case returns a number (the PID)= , and I think >>> =E2=80=98test-assert=E2=80=99 reports a failure when the value is not e= xactly #t. Isn=E2=80=99t >>> it the case? >> >> srfi-64 says: "The test passes if the result is true", so I believe >> test-assert reports a failure only when the value is #f (and maybe on >> exceptions), because anything else is true in Scheme. > > Yeah I know; I had a vague recollection of SRFI-64 behaving funny but > that=E2=80=99s no longer the case. So I guess you can go ahead. > > Thank you! Pushed, thank you for reviewing! ------------=_1528874042-4453-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Jun 2018 22:05:42 +0000 Received: from localhost ([127.0.0.1]:43759 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSUwS-0006L5-6O for submit@debbugs.gnu.org; Mon, 11 Jun 2018 18:05:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38803) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSUwP-0006Ks-KO for submit@debbugs.gnu.org; Mon, 11 Jun 2018 18:05:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSUwH-0006JL-N0 for submit@debbugs.gnu.org; Mon, 11 Jun 2018 18:05:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43857) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSUwH-0006J2-H1 for submit@debbugs.gnu.org; Mon, 11 Jun 2018 18:05:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSUwF-0004DJ-7u for guix-patches@gnu.org; Mon, 11 Jun 2018 18:05:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSUwB-0006Fo-RD for guix-patches@gnu.org; Mon, 11 Jun 2018 18:05:23 -0400 Received: from mail.lassieur.org ([83.152.10.219]:49578) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSUwB-0006E3-5x for guix-patches@gnu.org; Mon, 11 Jun 2018 18:05:19 -0400 Received: from localhost.localdomain (88.191.118.83 [88.191.118.83]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 12f1050a (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Mon, 11 Jun 2018 22:05:16 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20Lassieur?= To: guix-patches@gnu.org Subject: [PATCH] tests: Honor the return value of 'start-service'. Date: Tue, 12 Jun 2018 00:05:08 +0200 Message-Id: <20180611220508.17320-1-clement@lassieur.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Since commit dc7b3e56337ee9d8dcd8fe7d5cab71ef536d024f, 'start-service' returns the Shepherd's representation of the service as a sexp, and '#f' if the service fails to start. Also, it doesn't throw an exception when the service fails to start, so relying on an exception instead of relying on its return value is a false positive. * gnu/tests/base.scm (run-nss-mdns-test): Split tests so to check the return value of 'start-service'. (run-mcron-test, run-nss-mdns-test): Use 'test-assert' with the return value of 'start-service'. * gnu/tests/admin.scm (run-tailon-test): Idem. * gnu/tests/dict.scm (run-dicod-test): Idem. * gnu/tests/mail.scm (run-opensmtpd-test, run-exim-test, run-dovecot-test): Idem. * gnu/tests/messaging.scm (run-xmpp-test, run-bitlbee-test): Idem. * gnu/tests/nfs.scm (run-nfs-test): Idem. * gnu/tests/rsync.scm (run-rsync-test): Idem. * gnu/tests/ssh.scm (run-ssh-test): Idem. * gnu/tests/version-control.scm (run-cgit-test, run-git-http-test): Idem. * gnu/tests/web.scm (run-php-fpm-test): Idem. --- gnu/tests/admin.scm | 7 ++-- gnu/tests/base.scm | 62 ++++++++++++++++++++--------------- gnu/tests/dict.scm | 7 ++-- gnu/tests/mail.scm | 13 +++----- gnu/tests/messaging.scm | 14 +++----- gnu/tests/nfs.scm | 7 ++-- gnu/tests/rsync.scm | 7 ++-- gnu/tests/ssh.scm | 8 ++--- gnu/tests/version-control.scm | 20 ++++------- gnu/tests/web.scm | 8 ++--- 10 files changed, 71 insertions(+), 82 deletions(-) diff --git a/gnu/tests/admin.scm b/gnu/tests/admin.scm index 3c7deb542..a5abbe9ad 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 +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 3faeddef6..05c846264 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 +;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. ;;; @@ -517,13 +518,11 @@ in a loop. See .") (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 +618,43 @@ in a loop. See .") (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 4431e37dc..dd60ffd46 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 +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 4de13b868..5677969fa 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2017 Carlo Zancanaro ;;; Copyright © 2017 Ludovic Courtès ;;; Copyright © 2018 Oleg Pykhalov +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 f17dfe626..f5f99b9f5 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 +;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2017, 2018 Ludovic Courtès ;;; ;;; 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 d58cf7aef..140f03779 100644 --- a/gnu/tests/nfs.scm +++ b/gnu/tests/nfs.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2016 John Darrington ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 c97836788..a6f8fa2bd 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 +;;; Copyright © 2018 Clément Lassieur ;;; ;;; 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 9247a43e6..2e40122ad 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 -;;; Copyright © 2017 Clément Lassieur +;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2017 Marius Bakke ;;; ;;; 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 802473973..3b935a1b4 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 ;;; Copyright © 2017, 2018 Ludovic Courtès -;;; Copyright © 2017 Clément Lassieur +;;; Copyright © 2017, 2018 Clément Lassieur ;;; ;;; 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 a6bf6efcf..73d502dd0 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 ;;; Copyright © 2017 Christopher Baines -;;; Copyright © 2017 Clément Lassieur +;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2018 Pierre-Antoine Rouby ;;; ;;; 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" -- 2.17.1 ------------=_1528874042-4453-1--