From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSpWP-0004BE-Jd for guix-patches@gnu.org; Tue, 12 Jun 2018 16:04:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSpWM-000303-Fz for guix-patches@gnu.org; Tue, 12 Jun 2018 16:04:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:37482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSpWM-0002zi-CT for guix-patches@gnu.org; Tue, 12 Jun 2018 16:04:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fSpWL-0004yl-Uf for guix-patches@gnu.org; Tue, 12 Jun 2018 16:04:01 -0400 Subject: [bug#31788] [PATCH] tests: Honor the return value of 'start-service'. Resent-Message-ID: References: <20180611220508.17320-1-clement@lassieur.org> <87r2lbokjl.fsf@gnu.org> 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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 31788@debbugs.gnu.org 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))