pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
Date: Tue, 10 May 2022 09:57:29 +0900
Message-ID: <Ynm4ecSwODdS23EA@paquier.xyz> (raw)
In-Reply-To: <d7897033-f823-f670-ec57-d68eeb9ad7e3@dunslane.net>
References: <E1nJpf1-0003FC-Od@gemulon.postgresql.org>
	<14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net>
	<Ym6IAq48gBBm5Ujv@paquier.xyz>
	<12a044c9-e982-48d9-dd29-be1216a08805@dunslane.net>
	<Ym+DAUUbc7LpseOf@paquier.xyz>
	<5be02606-a9de-9252-5277-269cae0ad1f0@dunslane.net>
	<YnW5vFw4tBqX6yRA@paquier.xyz>
	<YnimcaZH0tpiHbMQ@paquier.xyz>
	<d7897033-f823-f670-ec57-d68eeb9ad7e3@dunslane.net>

On Mon, May 09, 2022 at 10:10:27AM -0400, Andrew Dunstan wrote:
> The system() call should include redirection, since we only case about
> the return code.

Okay, done using File::Spec::devnull.

> I would just write this
> 
> as
> 
>     $ENV{$envname} = $envdefault if $rc == 0;
> 
> There should be no need to set it to the empty string in case if
> failure, we already know it's undefined.

This needs to be adjusted on all the stable branches, so I'll do that
once this week's version is tagged.  Attached is an updated patch for
now.
--
Michael

Attachments:

win32-vcregress-env-v2.patch (text/x-diff, 2.4K) download diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index fc7aa8b9a3..9bfc8b897b 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -14,6 +14,7 @@ use File::Basename; use File::Copy; use File::Find (); use File::Path qw(rmtree); +use File::Spec qw(devnull); use FindBin; use lib $FindBin::RealBin; @@ -30,13 +31,14 @@ my $tmp_installdir = "$topdir/tmp_install"; do './src/tools/msvc/config_default.pl'; do './src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl'); +my $devnull = File::Spec->devnull; + # These values are defaults that can be overridden by the calling environment -# (see buildenv.pl processing below). +# (see buildenv.pl processing below). We assume that the ones listed here +# always exist by default. Other values may optionally be set for bincheck +# or taptest, see set_command_env() below. # c.f. src/Makefile.global.in and configure.ac -$ENV{GZIP_PROGRAM} ||= 'gzip'; -$ENV{LZ4} ||= 'lz4'; $ENV{TAR} ||= 'tar'; -$ENV{ZSTD} ||= 'zstd'; # buildenv.pl is for specifying the build environment settings # it should contain lines like: @@ -119,6 +121,34 @@ exit 0; ######################################################################## +# Helper function for set_command_env, to set one environment command. +sub set_single_env +{ + my $envname = shift; + my $envdefault = shift; + + # If a command is defined by the environment, just use it. + return if (defined($ENV{$envname})); + + # Nothing is defined, so attempt to assign a default. The command + # may not be in the current environment, hence check if it can be + # executed. + my $rc = system("$envdefault --version >$devnull 2>&1"); + + # Set the environment to the default if it exists, else leave it. + $ENV{$envname} = $envdefault if $rc == 0; + return; +} + +# Set environment values for various command types. These can be used +# in the TAP tests. +sub set_command_env +{ + set_single_env('GZIP_PROGRAM', 'gzip'); + set_single_env('LZ4', 'lz4'); + set_single_env('ZSTD', 'zstd'); +} + sub installcheck_internal { my ($schedule, @EXTRA_REGRESS_OPTS) = @_; @@ -276,6 +306,8 @@ sub bincheck { InstallTemp(); + set_command_env(); + my $mstat = 0; # Find out all the existing TAP tests by looking for t/ directories @@ -310,6 +342,9 @@ sub taptest push(@args, "$topdir/$dir"); InstallTemp(); + + set_command_env(); + my $status = tap_check(@args); exit $status if $status; return;
signature.asc (application/pgp-signature, 832B) download

view thread (11+ messages)  latest in thread

Message-ID: <Ynm4ecSwODdS23EA@paquier.xyz>
Permalink:  ../Ynm4ecSwODdS23EA@paquier.xyz/
Also on:    postgresql.org/message-id/Ynm4ecSwODdS23EA@paquier.xyz

 ·  · 

reply

Reply instructions:

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

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, andrew@dunslane.net
  Subject: Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
  In-Reply-To: <Ynm4ecSwODdS23EA@paquier.xyz>
  References: <E1nJpf1-0003FC-Od@gemulon.postgresql.org> <14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net> <Ym6IAq48gBBm5Ujv@paquier.xyz> <12a044c9-e982-48d9-dd29-be1216a08805@dunslane.net> <Ym+DAUUbc7LpseOf@paquier.xyz> <5be02606-a9de-9252-5277-269cae0ad1f0@dunslane.net> <YnW5vFw4tBqX6yRA@paquier.xyz> <YnimcaZH0tpiHbMQ@paquier.xyz> <d7897033-f823-f670-ec57-d68eeb9ad7e3@dunslane.net> <Ynm4ecSwODdS23EA@paquier.xyz>

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

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox