From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id n2EkGixdq19NUAAA0tVLHw (envelope-from ) for ; Wed, 11 Nov 2020 03:40:28 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0JSjFSxdq1+UKgAAbx9fmQ (envelope-from ) for ; Wed, 11 Nov 2020 03:40:28 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D45179401BD for ; Wed, 11 Nov 2020 03:40:27 +0000 (UTC) Received: from localhost ([::1]:48192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcgzi-0002W7-AZ for larch@yhetil.org; Tue, 10 Nov 2020 22:40:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcgzK-0002VQ-FY for bug-guix@gnu.org; Tue, 10 Nov 2020 22:40:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:56395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kcgzK-00033V-5N for bug-guix@gnu.org; Tue, 10 Nov 2020 22:40:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kcgzK-00016c-13 for bug-guix@gnu.org; Tue, 10 Nov 2020 22:40:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#44491: Support GUIX_DISABLE_NETWORK_TESTS environment variable Resent-From: Vagrant Cascadian Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 11 Nov 2020 03:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44491 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 44491-submit@debbugs.gnu.org id=B44491.16050659874226 (code B ref 44491); Wed, 11 Nov 2020 03:40:01 +0000 Received: (at 44491) by debbugs.gnu.org; 11 Nov 2020 03:39:47 +0000 Received: from localhost ([127.0.0.1]:39708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kcgyw-00015w-Rr for submit@debbugs.gnu.org; Tue, 10 Nov 2020 22:39:47 -0500 Received: from cascadia.aikidev.net ([173.255.214.101]:40780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kcgyu-00015h-QC for 44491@debbugs.gnu.org; Tue, 10 Nov 2020 22:39:37 -0500 Received: from localhost (unknown [IPv6:2600:3c01:e000:21:21:21:0:100b]) (Authenticated sender: vagrant@cascadia.debian.net) by cascadia.aikidev.net (Postfix) with ESMTPSA id 6459E1AA41; Tue, 10 Nov 2020 19:39:30 -0800 (PST) From: Vagrant Cascadian In-Reply-To: <87wnysnbs6.fsf@gnu.org> References: <87k0uy6um8.fsf@yucca> <87y2jbu4gx.fsf@gnu.org> <87k0utt6zt.fsf@yucca> <87wnysnbs6.fsf@gnu.org> Date: Tue, 10 Nov 2020 19:39:25 -0800 Message-ID: <87h7pwtvde.fsf@yucca> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 44491@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -1.11 X-TUID: 01FIi4lL8Zcp --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2020-11-10, Ludovic Court=C3=A8s wrote: > Vagrant Cascadian skribis: >> On 2020-11-08, Ludovic Court=C3=A8s wrote: >>> Vagrant Cascadian skribis: >>> >>>> If this could be considered for the upcoming 1.2 release, that would be >>>> appreciated, though I can also carry the patches in Debian... >>> >>> Yay! It should be doable, let=E2=80=99s see. >> >> It seems like a simpler workaround is to pass RES_OPTIONS=3Dattempts:0, >> which should disable name resolution, and thus the network checks will >> fail. >> >> With the RES_OPTIONS workaround, the changes to guix/tests.scm >> network-reachable are no longer needed ... i think. :) > > Oooh nice, the wonders of glibc! > >> Might still be worth refactoring some of *.sh tests to use common >> functions, since the code is basically copied and pasted in several >> different places. > > Yes, that=E2=80=99s still a good idea. Would you like to adjust your pat= ch > accordingly? Thanks for the review! Updated patch attached, with changes: * Copyright header added to common.sh. * New function skip_if_network_unreachable in common.sh * Dropped GUIX_DISABLE_NETWORK_TESTS in favor of using RES_OPTIONS=3Dattempts:0. * Updated tests to use skip_if_network_unreachable or network_reachable. live well, vagrant --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-tests-Add-common-functions-for-to-check-for-network-.patch Content-Transfer-Encoding: quoted-printable From=203fd93fec957491450639c647e05a5f72f1e787fd Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Tue, 10 Nov 2020 19:26:04 -0800 Subject: [PATCH] tests: Add common functions for to check for network reachability. * tests/common.sh: New file. * tests/guix-build-branch.sh, tests/guix-pack.sh, tests/guix-package-net.sh: Use skip_if_network_unreachable function from common.sh. * tests/guix-environment.sh: Use network_reachable function from common.sh. =2D-- Makefile.am | 1 + tests/common.sh | 30 ++++++++++++++++++++++++++++++ tests/guix-build-branch.sh | 8 ++------ tests/guix-environment.sh | 5 ++--- tests/guix-pack.sh | 5 ++--- tests/guix-package-net.sh | 9 ++------- 6 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 tests/common.sh diff --git a/Makefile.am b/Makefile.am index e7053ee4f4..7dbe41201c 100644 =2D-- a/Makefile.am +++ b/Makefile.am @@ -599,6 +599,7 @@ EXTRA_DIST +=3D \ tests/test.drv \ tests/signing-key.pub \ tests/signing-key.sec \ + tests/common.sh \ tests/cve-sample.json \ tests/civodul.key \ tests/rsa.key \ diff --git a/tests/common.sh b/tests/common.sh new file mode 100644 index 0000000000..f9dd3c2c59 =2D-- /dev/null +++ b/tests/common.sh @@ -0,0 +1,30 @@ +# GNU Guix --- Functional package management for GNU +# Copyright =C2=A9 2018, 2019, 2020 Ludovic Court=C3=A8s +# Copyright =C2=A9 2020 Vagrant Cascadian +# +# 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 . + +network_reachable() { + if ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /de= v/null; then + return 0 + fi +} + +skip_if_network_unreachable() { + if ! network_reachable ; then + exit 77 + fi +} diff --git a/tests/guix-build-branch.sh b/tests/guix-build-branch.sh index 79aa06a58f..89f7ea4a08 100644 =2D-- a/tests/guix-build-branch.sh +++ b/tests/guix-build-branch.sh @@ -24,12 +24,8 @@ guix build --version =20 # 'guix build --with-branch' requires access to the network to clone the # Git repository below. =2D =2Dif ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/= null =2Dthen =2D # Skipping. =2D exit 77 =2Dfi +. $(dirname $0)/common.sh +skip_if_network_unreachable =20 orig_drv=3D"`guix build guile-gcrypt -d`" latest_drv=3D"`guix build guile-gcrypt --with-branch=3Dguile-gcrypt=3Dmast= er -d`" diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh index f8be48f0c0..ce01ac04be 100644 =2D-- a/tests/guix-environment.sh +++ b/tests/guix-environment.sh @@ -174,9 +174,8 @@ case "$transformed_drv" in *) false;; esac =20 =2D =2Dif guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/nu= ll =2Dthen +. $(dirname $0)/common.sh +if network_reachable ; then # Compute the build environment for the initial GNU Make. guix environment --bootstrap --no-substitutes --search-paths --pure \ -e '(@ (guix tests) gnu-make-for-tests)' > "$tmpdir/a" diff --git a/tests/guix-pack.sh b/tests/guix-pack.sh index 0339221ac2..822a67b157 100644 =2D-- a/tests/guix-pack.sh +++ b/tests/guix-pack.sh @@ -23,9 +23,8 @@ =20 # A network connection is required to build %bootstrap-coreutils&co, # which is required to run these tests with the --bootstrap option. =2Dif ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/= null; then =2D exit 77 =2Dfi +. $(dirname $0)/common.sh +skip_if_network_unreachable =20 guix pack --version =20 diff --git a/tests/guix-package-net.sh b/tests/guix-package-net.sh index 6d21c6cff6..f682d09245 100644 =2D-- a/tests/guix-package-net.sh +++ b/tests/guix-package-net.sh @@ -38,13 +38,8 @@ shebang_too_long () -ge 128 } =20 =2Dif ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/= null \ =2D || shebang_too_long =2Dthen =2D # Skipping. =2D exit 77 =2Dfi =2D +. $(dirname $0)/common.sh +skip_if_network_unreachable =20 profile=3D"t-profile-$$" profile_alt=3D"t-profile-alt-$$" =2D-=20 2.20.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCX6tc7QAKCRDcUY/If5cW qjXoAP9UwrTCnDK4W+RXRtHS95MhDkaSZFebR/N/Rs1DXzM+pQEA8H53YfNavNQv KQt2jiawV5ROLVdUhuXVJGUfjEgphAI= =lrkr -----END PGP SIGNATURE----- --==-=-=--