GNU bug report logs - #31788
[PATCH] tests: Honor the return value of 'start-service'.

Previous Next

Package: guix-patches;

Reported by: Clément Lassieur <clement <at> lassieur.org>

Date: Mon, 11 Jun 2018 22:06:02 UTC

Severity: normal

Tags: patch

Done: Clément Lassieur <clement <at> lassieur.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31788 in the body.
You can then email your comments to 31788 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#31788; Package guix-patches. (Mon, 11 Jun 2018 22:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Lassieur <clement <at> lassieur.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 11 Jun 2018 22:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: guix-patches <at> gnu.org
Subject: [PATCH] tests: Honor the return value of 'start-service'.
Date: Tue, 12 Jun 2018 00:05:08 +0200
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 <mail <at> cbaines.net>
+;;; Copyright © 2018 Clément Lassieur <clement <at> 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 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 <ludo <at> gnu.org>
+;;; Copyright © 2018 Clément Lassieur <clement <at> lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -517,13 +518,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 +618,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 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 <ludo <at> gnu.org>
+;;; Copyright © 2018 Clément Lassieur <clement <at> 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 4de13b868..5677969fa 100644
--- a/gnu/tests/mail.scm
+++ b/gnu/tests/mail.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017 Carlo Zancanaro <carlo <at> zancanaro.id.au>
 ;;; Copyright © 2017 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2018 Clément Lassieur <clement <at> 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 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 <clement <at> lassieur.org>
+;;; Copyright © 2017, 2018 Clément Lassieur <clement <at> lassieur.org>
 ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo <at> 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 d58cf7aef..140f03779 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016 John Darrington <jmd <at> gnu.org>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2018 Clément Lassieur <clement <at> 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 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 <mail <at> cbaines.net>
+;;; Copyright © 2018 Clément Lassieur <clement <at> 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 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 <ludo <at> gnu.org>
-;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
+;;; Copyright © 2017, 2018 Clément Lassieur <clement <at> lassieur.org>
 ;;; Copyright © 2017 Marius Bakke <mbakke <at> 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 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 <go.wigust <at> gmail.com>
 ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo <at> gnu.org>
-;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
+;;; Copyright © 2017, 2018 Clément Lassieur <clement <at> 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 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 <ludo <at> gnu.org>
 ;;; Copyright © 2017 Christopher Baines <mail <at> cbaines.net>
-;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
+;;; Copyright © 2017, 2018 Clément Lassieur <clement <at> lassieur.org>
 ;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby <at> 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"
-- 
2.17.1





Information forwarded to guix-patches <at> gnu.org:
bug#31788; Package guix-patches. (Tue, 12 Jun 2018 19:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 31788 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 31788 <at> debbugs.gnu.org
Subject: Re: [bug#31788] [PATCH] tests: Honor the return value of
 'start-service'.
Date: Tue, 12 Jun 2018 21:46:06 +0200
Hi Clément,

Clément Lassieur <clement <at> lassieur.org> 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 service
> fails to start, so relying on an exception instead of relying on its return
> value is a false positive.

Looking at ‘invoke-action’ (used by ‘start-service’) 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’s one case where an exception isn’t raised, and that’s when
shepherd returns something completely bogus:

      (x
       ;; invalid reply
       #f)

Am I missing something?

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#31788; Package guix-patches. (Tue, 12 Jun 2018 20:04:01 GMT) Full text and rfc822 format available.

Message #11 received at 31788 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 31788 <at> debbugs.gnu.org
Subject: Re: [bug#31788] [PATCH] tests: Honor the return value of
 'start-service'.
Date: Tue, 12 Jun 2018 22:03:24 +0200
Hi Ludovic,

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi Clément,
>
> Clément Lassieur <clement <at> lassieur.org> 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 service
>> fails to start, so relying on an exception instead of relying on its return
>> value is a false positive.
>
> Looking at ‘invoke-action’ (used by ‘start-service’) 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))




Information forwarded to guix-patches <at> gnu.org:
bug#31788; Package guix-patches. (Tue, 12 Jun 2018 20:39:01 GMT) Full text and rfc822 format available.

Message #14 received at 31788 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 31788 <at> debbugs.gnu.org
Subject: Re: [bug#31788] [PATCH] tests: Honor the return value of
 'start-service'.
Date: Tue, 12 Jun 2018 22:38:38 +0200
Clément Lassieur <clement <at> lassieur.org> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> Hi Clément,
>>
>> Clément Lassieur <clement <at> lassieur.org> 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 service
>>> fails to start, so relying on an exception instead of relying on its return
>>> value is a false positive.
>>
>> Looking at ‘invoke-action’ (used by ‘start-service’) 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’re right, sorry for the confusion.  So on success
‘start-service’ returns a truth value, and we’re fine.

I’m 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))

‘start-service’ in this case returns a number (the PID), and I think
‘test-assert’ reports a failure when the value is not exactly #t.  Isn’t
it the case?

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#31788; Package guix-patches. (Tue, 12 Jun 2018 20:52:01 GMT) Full text and rfc822 format available.

Message #17 received at 31788 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 31788 <at> debbugs.gnu.org
Subject: Re: [bug#31788] [PATCH] tests: Honor the return value of
 'start-service'.
Date: Tue, 12 Jun 2018 22:50:57 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> I’m 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))
>
> ‘start-service’ in this case returns a number (the PID), and I think
> ‘test-assert’ reports a failure when the value is not exactly #t.  Isn’t
> 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.




Information forwarded to guix-patches <at> gnu.org:
bug#31788; Package guix-patches. (Wed, 13 Jun 2018 06:52:02 GMT) Full text and rfc822 format available.

Message #20 received at 31788 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 31788 <at> debbugs.gnu.org
Subject: Re: [bug#31788] [PATCH] tests: Honor the return value of
 'start-service'.
Date: Wed, 13 Jun 2018 08:51:01 +0200
Clément Lassieur <clement <at> lassieur.org> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> I’m 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))
>>
>> ‘start-service’ in this case returns a number (the PID), and I think
>> ‘test-assert’ reports a failure when the value is not exactly #t.  Isn’t
>> 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’s no longer the case.  So I guess you can go ahead.

Thank you!

Ludo’.




Reply sent to Clément Lassieur <clement <at> lassieur.org>:
You have taken responsibility. (Wed, 13 Jun 2018 07:14:02 GMT) Full text and rfc822 format available.

Notification sent to Clément Lassieur <clement <at> lassieur.org>:
bug acknowledged by developer. (Wed, 13 Jun 2018 07:14:02 GMT) Full text and rfc822 format available.

Message #25 received at 31788-done <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 31788-done <at> debbugs.gnu.org
Subject: Re: [bug#31788] [PATCH] tests: Honor the return value of
 'start-service'.
Date: Wed, 13 Jun 2018 09:13:34 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> Clément Lassieur <clement <at> lassieur.org> skribis:
>
>> Ludovic Courtès <ludo <at> gnu.org> writes:
>>
>>> I’m 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))
>>>
>>> ‘start-service’ in this case returns a number (the PID), and I think
>>> ‘test-assert’ reports a failure when the value is not exactly #t.  Isn’t
>>> 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’s no longer the case.  So I guess you can go ahead.
>
> Thank you!

Pushed, thank you for reviewing!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 11 Jul 2018 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.