unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Vagrant Cascadian <vagrant@debian.org>
Cc: 44491@debbugs.gnu.org
Subject: bug#44491: Support GUIX_DISABLE_NETWORK_TESTS environment variable
Date: Sun, 08 Nov 2020 18:46:06 +0100	[thread overview]
Message-ID: <87y2jbu4gx.fsf@gnu.org> (raw)
In-Reply-To: <87k0uy6um8.fsf@yucca> (Vagrant Cascadian's message of "Fri, 06 Nov 2020 13:30:39 -0800")

Hi Vagrant,

Vagrant Cascadian <vagrant@debian.org> 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’s see.

> From 36516e767f68dbc2bd3dc186f956c0b0fd7de9f1 Mon Sep 17 00:00:00 2001
> From: Vagrant Cascadian <vagrant@debian.org>
> 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.

[...]

> --- /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 ‘EXTRA_DIST’ in Makefile.am.

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

  • a ‘network_reachable’ function that returns true or false, without
    exiting;

  • a ‘skip_if_network_is_unreachable’ function that does “exit 77” when
    network is “unreachable”.

> --- a/tests/guix-environment.sh
> +++ b/tests/guix-environment.sh
> @@ -174,9 +174,9 @@ case "$transformed_drv" in
>      *)           false;;
>  esac
>  
> +. $(dirname $0)/common.sh
> +network_reachable
>  
> -if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
> -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’d write “if network_reachable”
instead of “skip_if_network_is_unreachable”.

WDYT?

Thanks!

Ludo’.




  reply	other threads:[~2020-11-08 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 21:30 bug#44491: Support GUIX_DISABLE_NETWORK_TESTS environment variable Vagrant Cascadian
2020-11-08 17:46 ` Ludovic Courtès [this message]
2020-11-10 18:13   ` Vagrant Cascadian
2020-11-10 21:26     ` Ludovic Courtès
2020-11-11  3:39       ` Vagrant Cascadian
2020-11-11  6:06         ` Vagrant Cascadian
2020-12-03 17:09           ` Ludovic Courtès
2020-12-03 19:13             ` Vagrant Cascadian
2020-12-07  7:55               ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2jbu4gx.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=44491@debbugs.gnu.org \
    --cc=vagrant@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).