GNU bug report logs - #44491
Support GUIX_DISABLE_NETWORK_TESTS environment variable

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Vagrant Cascadian <vagrant@HIDDEN>; dated Fri, 6 Nov 2020 21:31:01 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 44491 <at> debbugs.gnu.org:


Received: (at 44491) by debbugs.gnu.org; 8 Nov 2020 17:46:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 08 12:46:17 2020
Received: from localhost ([127.0.0.1]:32993 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kbold-0003BN-E6
	for submit <at> debbugs.gnu.org; Sun, 08 Nov 2020 12:46:17 -0500
Received: from eggs.gnu.org ([209.51.188.92]:57518)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kbola-0003Aq-EM
 for 44491 <at> debbugs.gnu.org; Sun, 08 Nov 2020 12:46:15 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:54007)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kbolU-0006I6-Eb; Sun, 08 Nov 2020 12:46:08 -0500
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=56510 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kbolT-00032h-VB; Sun, 08 Nov 2020 12:46:08 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Vagrant Cascadian <vagrant@HIDDEN>
Subject: Re: bug#44491: Support GUIX_DISABLE_NETWORK_TESTS environment variable
References: <87k0uy6um8.fsf@yucca>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 18 Brumaire an 229 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: Sun, 08 Nov 2020 18:46:06 +0100
In-Reply-To: <87k0uy6um8.fsf@yucca> (Vagrant Cascadian's message of "Fri, 06
 Nov 2020 13:30:39 -0800")
Message-ID: <87y2jbu4gx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44491
Cc: 44491 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Vagrant,

Vagrant Cascadian <vagrant@HIDDEN> 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.

> From 36516e767f68dbc2bd3dc186f956c0b0fd7de9f1 Mon Sep 17 00:00:00 2001
> From: Vagrant Cascadian <vagrant@HIDDEN>
> Date: Thu, 5 Nov 2020 17:35:52 -0800
> Subject: [PATCH] tests: Support disabling network tests.
>
> This is needed for packaging GNU Guix in Debian, where packaging policies
> prohibit network access during builds, but may not technically block netw=
ork
> access during builds.
>
> * guix/tests.scm (network-reachable): Return #f when
>   GUIX_DISABLE_NETWORK_TESTS is set.
> * tests/common.sh: New file.
> * tests/guix-build-branch.sh, tests/guix-environment.sh,
>   tests/guix-pack.sh, tests/guix-package-net.sh: Use
>   network_reachable function from common.sh.

[...]

> --- /dev/null
> +++ b/tests/common.sh
> @@ -0,0 +1,8 @@
> +network_reachable() {
> +    if [ -n "$GUIX_DISABLE_NETWORK_TESTS" ]; then
> +		exit 77
> +    fi
> +    if ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /=
dev/null; then
> +        exit 77
> +    fi
> +}

Could you add the usual copyright/license header?  Also please add this
file to =E2=80=98EXTRA_DIST=E2=80=99 in Makefile.am.

Looking at the tests you modified, we need two things:

  =E2=80=A2 a =E2=80=98network_reachable=E2=80=99 function that returns tru=
e or false, without
    exiting;

  =E2=80=A2 a =E2=80=98skip_if_network_is_unreachable=E2=80=99 function tha=
t does =E2=80=9Cexit 77=E2=80=9D when
    network is =E2=80=9Cunreachable=E2=80=9D.

> --- a/tests/guix-environment.sh
> +++ b/tests/guix-environment.sh
> @@ -174,9 +174,9 @@ case "$transformed_drv" in
>      *)           false;;
>  esac
>=20=20
> +. $(dirname $0)/common.sh
> +network_reachable
>=20=20
> -if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/nu=
ll
> -then
>      # Compute the build environment for the initial GNU Make.
>      guix environment --bootstrap --no-substitutes --search-paths --pure \

I think this is the only place where you=E2=80=99d write =E2=80=9Cif networ=
k_reachable=E2=80=9D
instead of =E2=80=9Cskip_if_network_is_unreachable=E2=80=9D.

WDYT?

Thanks!

Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#44491; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 6 Nov 2020 21:31:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 06 16:31:00 2020
Received: from localhost ([127.0.0.1]:57478 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kb9Jt-0001J3-TD
	for submit <at> debbugs.gnu.org; Fri, 06 Nov 2020 16:31:00 -0500
Received: from lists.gnu.org ([209.51.188.17]:59380)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vagrant@HIDDEN>) id 1kb9Jr-0001Iv-Tb
 for submit <at> debbugs.gnu.org; Fri, 06 Nov 2020 16:30:52 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:34486)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <vagrant@HIDDEN>)
 id 1kb9Jr-0002iz-N9
 for bug-guix@HIDDEN; Fri, 06 Nov 2020 16:30:51 -0500
Received: from cascadia.aikidev.net ([173.255.214.101]:58090)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <vagrant@HIDDEN>) id 1kb9Jp-0002gE-KF
 for bug-guix@HIDDEN; Fri, 06 Nov 2020 16:30:51 -0500
Received: from localhost (unknown [IPv6:2600:3c01:e000:21:21:21:0:100b])
 (Authenticated sender: vagrant@HIDDEN)
 by cascadia.aikidev.net (Postfix) with ESMTPSA id 502F61AA41
 for <bug-guix@HIDDEN>; Fri,  6 Nov 2020 13:30:44 -0800 (PST)
From: Vagrant Cascadian <vagrant@HIDDEN>
To: bug-guix@HIDDEN
Subject: Support GUIX_DISABLE_NETWORK_TESTS environment variable
Date: Fri, 06 Nov 2020 13:30:39 -0800
Message-ID: <87k0uy6um8.fsf@yucca>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
Received-SPF: none client-ip=173.255.214.101; envelope-from=vagrant@HIDDEN;
 helo=cascadia.aikidev.net
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/06 16:30:46
X-ACL-Warn: Detected OS   = Linux 3.11 and newer [fuzzy]
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_NONE=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain

The following patch adds a GUIX_DISABLE_NETWORK_TESTS environment
variable and disables tests that require network access when it is set.

This is needed for packaging GNU Guix in Debian, where packaging policies
prohibit network access during builds, but may not technically block network
access during builds.

If this could be considered for the upcoming 1.2 release, that would be
appreciated, though I can also carry the patches in Debian...


live well,
  vagrant

--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-tests-Support-disabling-network-tests.patch
Content-Transfer-Encoding: quoted-printable

From=2036516e767f68dbc2bd3dc186f956c0b0fd7de9f1 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@HIDDEN>
Date: Thu, 5 Nov 2020 17:35:52 -0800
Subject: [PATCH] tests: Support disabling network tests.

This is needed for packaging GNU Guix in Debian, where packaging policies
prohibit network access during builds, but may not technically block network
access during builds.

* guix/tests.scm (network-reachable): Return #f when
  GUIX_DISABLE_NETWORK_TESTS is set.
* tests/common.sh: New file.
* tests/guix-build-branch.sh, tests/guix-environment.sh,
  tests/guix-pack.sh, tests/guix-package-net.sh: Use
  network_reachable function from common.sh.
=2D--
 guix/tests.scm             | 7 +++++--
 tests/common.sh            | 8 ++++++++
 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, 21 insertions(+), 21 deletions(-)
 create mode 100644 tests/common.sh

diff --git a/guix/tests.scm b/guix/tests.scm
index fc3d521163..9f98cef33f 100644
=2D-- a/guix/tests.scm
+++ b/guix/tests.scm
@@ -204,8 +204,11 @@ too expensive to build entirely in the test store."
              (zero? (logand #o222 (stat:mode st)))))))
=20
 (define (network-reachable?)
=2D  "Return true if we can reach the Internet."
=2D  (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)))
+  "Return true if we can reach the Internet and GUIX_DISABLE_NETWORK_TESTS
+is not set."
+  (if (getenv "GUIX_DISABLE_NETWORK_TESTS")
+      #f
+      (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV))=
))
=20
 (define-syntax-rule (mock (module proc replacement) body ...)
   "Within BODY, replace the definition of PROC from MODULE with the defini=
tion
diff --git a/tests/common.sh b/tests/common.sh
new file mode 100644
index 0000000000..b91c0bdcd4
=2D-- /dev/null
+++ b/tests/common.sh
@@ -0,0 +1,8 @@
+network_reachable() {
+    if [ -n "$GUIX_DISABLE_NETWORK_TESTS" ]; then
+		exit 77
+    fi
+    if ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /de=
v/null; then
+        exit 77
+    fi
+}
diff --git a/tests/guix-build-branch.sh b/tests/guix-build-branch.sh
index 79aa06a58f..55f8f388ab 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
+network_reachable
=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..d140566aef 100644
=2D-- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -174,9 +174,9 @@ case "$transformed_drv" in
     *)           false;;
 esac
=20
+. $(dirname $0)/common.sh
+network_reachable
=20
=2Dif guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/nu=
ll
=2Dthen
     # 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"
@@ -244,4 +244,3 @@ then
     do
 	guix gc --references "$profile" | grep "$dep"
     done
=2Dfi
diff --git a/tests/guix-pack.sh b/tests/guix-pack.sh
index 0339221ac2..bc902c7e90 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
+network_reachable
=20
 guix pack --version
=20
diff --git a/tests/guix-package-net.sh b/tests/guix-package-net.sh
index 6d21c6cff6..ec7952f63d 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
+network_reachable
=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/If5cWqgUCX6XAfwAKCRDcUY/If5cW
qqS3AP9xHOh0mV9gisiPEKxYc5qbg2qRZnOq7F3sNFD5WqYe2QEA/RQPsPQGm7cH
a9ldBpc0KYxfLfybPxyBtWIy2x34ng4=
=KzMF
-----END PGP SIGNATURE-----
--==-=-=--




Acknowledgement sent to Vagrant Cascadian <vagrant@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#44491; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 8 Nov 2020 18:00:02 UTC

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