From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 01 09:56:32 2021 Received: (at 50912) by debbugs.gnu.org; 1 Oct 2021 13:56:32 +0000 Received: from localhost ([127.0.0.1]:56779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWJ1S-0004qJ-SL for submit@debbugs.gnu.org; Fri, 01 Oct 2021 09:56:32 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:48802 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWJ1M-0004q1-So for 50912@debbugs.gnu.org; Fri, 01 Oct 2021 09:56:21 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1633096568; bh=EHmAe+Sg+TjSKty/u0DThZQoDqOhf8ukGTeGc1OX19g=; h=From:To:Subject:In-Reply-To:References:Date; b=JC++vWiqdhJ6LOxTz4GoaQ6iQ9rbbeCH+6DdKB7pkLq7gNk/Heu62xHtqgy532WU+ AcTXvJ0Z/qOqAfFX0ewUtY+pwI8lHhn8suZoYxQggcWe7yiFvQlIS2yQi+4jVTBcg5 RmVk9pYGp4cL4WhaBdANHNnmxmpzCPr6V8CHdlfk= To: Andrew Tropin , 50912@debbugs.gnu.org Subject: Re: [bug#50912] [PATCH] tests: Add tests for guix home cli. In-Reply-To: <87lf3e4l26.fsf@trop.in> References: <87lf3e4l26.fsf@trop.in> Date: Fri, 01 Oct 2021 15:56:05 +0200 Message-ID: <87v92gluh6.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 2.9 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Thu, Sep 30 2021, Andrew Tropin wrote: > * tests/guix-home.sh: New file. > * Makefile.am (SH_TESTS): Add tests/guix-home.sh. > --- > > > Makefile.am | 1 + > tests/guix-home.sh | 99 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files c [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.0 PDS_RDNS_DYNAMIC_FP RDNS_DYNAMIC with FP steps X-Debbugs-Envelope-To: 50912 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: 2.9 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Thu, Sep 30 2021, Andrew Tropin wrote: > * tests/guix-home.sh: New file. > * Makefile.am (SH_TESTS): Add tests/guix-home.sh. > --- > > > Makefile.am | 1 + > tests/guix-home.sh | 99 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files c [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 1.0 BULK_RE_SUSP_NTLD Precedence bulk and RE: from a suspicious TLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.0 PDS_RDNS_DYNAMIC_FP RDNS_DYNAMIC with FP steps --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Sep 30 2021, Andrew Tropin wrote: > * tests/guix-home.sh: New file. > * Makefile.am (SH_TESTS): Add tests/guix-home.sh. > --- > > > Makefile.am | 1 + > tests/guix-home.sh | 99 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 100 insertions(+) > create mode 100644 tests/guix-home.sh > > diff --git a/Makefile.am b/Makefile.am > index b66789fa0b..5bf2567dc8 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -546,6 +546,7 @@ SH_TESTS =3D \ > tests/guix-package-aliases.sh \ > tests/guix-package-net.sh \ > tests/guix-system.sh \ > + tests/guix-home.sh \ > tests/guix-archive.sh \ > tests/guix-authenticate.sh \ > tests/guix-environment.sh \ > diff --git a/tests/guix-home.sh b/tests/guix-home.sh > new file mode 100644 > index 0000000000..cb015c907f > --- /dev/null > +++ b/tests/guix-home.sh > @@ -0,0 +1,99 @@ > +# GNU Guix --- Functional package management for GNU > +# Copyright =C2=A9 2021 Andrew Tropin > +# > +# This file is part of GNU Guix. > +# > +# GNU Guix is free software; you can redistribute it and/or modify it > +# under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or (at > +# your option) any later version. > +# > +# GNU Guix is distributed in the hope that it will be useful, but > +# WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with GNU Guix. If not, see . > + > +# > +# Test 'guix home' cli. > +# > + > +set -e > + > +guix home --version > + > +tmpfile=3D"t-guix-home-$$" > +errorfile=3D"t-guix-home-error-$$" > + > +# Note: This directory is chosen outside $builddir so that relative file= name > +# canonicalization doesn't mess up with 'current-source-directory', used= by > +# 'local-file' ('load' forces 'relative' for > +# %FILE-PORT-NAME-CANONICALIZATION.) > +tmpdir=3D"${TMPDIR:-/tmp}/t-guix-home-$$" > +mkdir "$tmpdir" > + > +trap 'rm -f "$tmpfile" "$errorfile" "$tmpdir"/*; rmdir "$tmpdir"' EXIT > + > +# Reporting of syntax errors. > + > +cat > "$tmpfile"< +;; This is line 1, and the next one is line 2. > + (home-environment > + (packages)) > +;; The 'T' is at column 3. > +EOF > + > +if guix home build "$tmpfile" 2> "$errorfile" > +then > + # This must not succeed. > + exit 1 > +else > + grep "$tmpfile:3:4: error: (packages): invalid field specifier" "$er= rorfile" > +fi > + > + > +cat > "$tmpfile"< +;; This is line 1, and the next one is line 2. > + (home-environment > +;; This is line 3, and there is no closing paren! > +EOF > + > +if guix home build "$tmpfile" 2> "$errorfile" > +then > + # This must not succeed. > + exit 1 > +else > + # Guile 3.0.6 gets line/column numbers for 'read-error' wrong > + # (zero-indexed): . > + grep "$tmpfile:4:1: missing closing paren" "$errorfile" || \ > + grep "$tmpfile:3:0: missing closing paren" "$errorfile" > +fi > + > +# Reporting of duplicate system service declaration. > + > +cat > "$tmpfile" < +(use-modules (gnu)) > +(use-modules (gnu home-services shepherd)) > + > +(home-environment > + (services (list (service home-shepherd-service-type) > + (simple-service 'test-shepherd-extension > + home-shepherd-service-type '()) > + (service home-shepherd-service-type) > + (service home-shepherd-service-type)))) > +EOF > + > +if guix home build "$tmpfile" 2> "$errorfile" > +then > + # This must not succeed. > + exit 1 > +else > + grep "guix home: error: more than one target service of type 'home-s= hepherd'" "$errorfile" > +fi > + > +# Searching. > + > +guix home search mcron | grep "^name: home-mcron" > +guix home search job manager | grep "^name: home-mcron" > --=20 > 2.33.0 The tests themselves LGTM, but some additional things should probably be tested * The provided file doesn=E2=80=99t return a guix home build /tmp/test.scm guix home: error: '/tmp/test.scm' does not return a home environment * Maybe something like =E2=80=98Reporting unmet shepherd requirements=E2=80= =99 in =E2=80=98guix-system.sh=E2=80=99 =E2=80=98guix home import=E2=80=99 should also be tested, but we will have = to wait for the fixes[1] to get merged first. [1]: --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmFXE3UVHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x51foP/jATMBfo0RrSW152t7Ua1IysaUTP 0ddbdXijlzB9Yt5v6/f2p2/sTI+VvHZ8a2FtVvbVd0lK0qXQbrhjRcOW4SbZxuO/ gQF+b0mkaaP79mIP8hnrqY9pomAeW3/VEls8WY4Sq2uRMpqEBuCcMkUBp0pfja00 bdeyVGB5iADvY3igd8nMbQR078mMmrBaO+HVn9gObYHDOf0pbwPfsYouUu0O4kVU 8OHXG3ke9k/tKNKlpZTEqACX81luX7TTOzA3MYQCg6hiKL2kQnMCLwDZCDQCqZkP J3OOKzIz/HmwW4DtrWfSX8XthR6V1cadzRn863J2tChI3Yxiy9DWkvbJJaEY/tV0 CpS0P1c0SXn80TFOksJKpTERfvVdtX7lJF19fat46wfoi3f9BWHFFUnLwyEzssUM DLM04GDOD9x7XHg74fa7JEZCgaLUJ2XbImjnezZetBCecmWBqzSEdvbtewxqmGXe Ll0otjPOhBQN7B2kGD+hvIwt8WiK2N3RcrkfeRannDBSZUN4UkHop5lZU5O+vy9H Q2YFoPXymGg5ZqsD5NCdZ+DicfXTDYNp4ARFL46HMFQdsBcY1g8VBE4nQMeEHX0M mKME6pjpXb7f9zULCDeo8HAhX/Vpz2Sqsx02afD0BC3YGB/6P7Us8QcheCR+6v23 WeBbhW7VMR4hgJEq =+e42 -----END PGP SIGNATURE----- --=-=-=--