Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1noECB-0001ER-GT for pgsql-committers@arkaria.postgresql.org; Tue, 10 May 2022 00:57:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1noEC8-00068o-Rn for pgsql-committers@arkaria.postgresql.org; Tue, 10 May 2022 00:57:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1noEC7-000671-JF for pgsql-committers@lists.postgresql.org; Tue, 10 May 2022 00:57:44 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1noEC1-0001we-Rs for pgsql-committers@lists.postgresql.org; Tue, 10 May 2022 00:57:42 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 4896432008C3; Mon, 9 May 2022 20:57:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 09 May 2022 20:57:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1652144253; x=1652230653; bh=Pv09aY8+B8 0ykJGbYBhVnst89wKLRy7QzSeYMOhnZ+A=; b=Fz35JvIpA3KmiNfIdBYbecMKQA L+G6kL0ZlNLjKxHuafSDOo/53pqiyrdoEe19xbM/hWrR4Wk8R3JeA+y30Z1R7pqy hShT7lCiMZe5oi9Kojgso/FKFpkVC8ijbJGRSGpvermz3HOieYBP770yt9Ab5Uf2 +NklmhHD+qT4aGwF3yyagNZo75nSakIqADFAvy9dBU1wBBH2xjafbQViqL1GXNYF QhLWem+Gqy2Ryru+bxmOUzW1tjw/2yejnEaPO7jW22m0KniEX3lDULWNA7S4S0pH /GuJkAIU37aLpnqZIy8X306OB874Ujp2m2VKLlgeLjXkGTbQ6r5tCzN8LWkw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1652144253; x= 1652230653; bh=Pv09aY8+B80ykJGbYBhVnst89wKLRy7QzSeYMOhnZ+A=; b=h OoZaqHcnFRZYL9qothSSb/vrk1zdxjmk+jqb90u8wvvtibc3coiLEBKsJPR8pit/ nBBrIAiwWS8OgCh3mDfF6yj6GDxSbmbHIsAC6J+GD5/4ksXaB0But7KSqVzSJs/B S8m2/8eb4v9IERcpVJT3c3CxxRGsUrklnKmCOgWiPLLG85oRnGudN2g2szpdpV+v J06I7P833enVqhKq7zJNDoZk6Obv1LpUg0cRAl0uKlcpGhpIJhMDGJzWoo4OL2Dv QJw8kR51E+grBJ3HzBb5U6OaVLuCMytWA2jbTxv5MC/BTXvDFgDESxF0X4JDEQIs nkJV5Y8y6bmctznCfPSpA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrgedtgdeflecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt udenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpefgheehgfdufedugfefleegieff geefhfekfeffvdehfedutdehteegleetveekteenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 May 2022 20:57:32 -0400 (EDT) Date: Tue, 10 May 2022 09:57:29 +0900 From: Michael Paquier To: Andrew Dunstan Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Message-ID: References: <14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net> <12a044c9-e982-48d9-dd29-be1216a08805@dunslane.net> <5be02606-a9de-9252-5277-269cae0ad1f0@dunslane.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/3VV2viIDSFvpx07" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --/3VV2viIDSFvpx07 Content-Type: multipart/mixed; boundary="dU7kbCT1Ov2FEWSQ" Content-Disposition: inline --dU7kbCT1Ov2FEWSQ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > as >=20 > =A0=A0=A0 $ENV{$envname} =3D $envdefault if $rc =3D=3D 0; >=20 > 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 --dU7kbCT1Ov2FEWSQ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="win32-vcregress-env-v2.patch" Content-Transfer-Encoding: quoted-printable 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); =20 use FindBin; use lib $FindBin::RealBin; @@ -30,13 +31,14 @@ my $tmp_installdir =3D "$topdir/tmp_install"; do './src/tools/msvc/config_default.pl'; do './src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl'); =20 +my $devnull =3D File::Spec->devnull; + # These values are defaults that can be overridden by the calling environm= ent -# (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} ||=3D 'gzip'; -$ENV{LZ4} ||=3D 'lz4'; $ENV{TAR} ||=3D 'tar'; -$ENV{ZSTD} ||=3D 'zstd'; =20 # buildenv.pl is for specifying the build environment settings # it should contain lines like: @@ -119,6 +121,34 @@ exit 0; =20 ######################################################################## =20 +# Helper function for set_command_env, to set one environment command. +sub set_single_env +{ + my $envname =3D shift; + my $envdefault =3D 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 =3D system("$envdefault --version >$devnull 2>&1"); + + # Set the environment to the default if it exists, else leave it. + $ENV{$envname} =3D $envdefault if $rc =3D=3D 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) =3D @_; @@ -276,6 +306,8 @@ sub bincheck { InstallTemp(); =20 + set_command_env(); + my $mstat =3D 0; =20 # Find out all the existing TAP tests by looking for t/ directories @@ -310,6 +342,9 @@ sub taptest push(@args, "$topdir/$dir"); =20 InstallTemp(); + + set_command_env(); + my $status =3D tap_check(@args); exit $status if $status; return; --dU7kbCT1Ov2FEWSQ-- --/3VV2viIDSFvpx07 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmJ5uHkACgkQnvQgOdby QH3rvBAAl1yQZ400jCC0fKQ0MlwI1rYZptcU6oPbYs/Ye0aSN9ORx9FeE9T17CBI bjE4dLgBqoUHE3QrA+dFRUDHBe3HdVavxr88x7tjalVu2pnLc8j0llOjNoKhm2FW PHfZzpalHgCoe6mD/D0+YOlSNZjSvSz9CGPdUp7O3Aa96Eesvm7ZGOm+s0M2FMg2 dLZoUM2G5kCXu11bucZX3DokL/noZ+zs6FenztO0nZsn4b+1b45iah92r4ejjxHZ NWbxZx5DO5paXFRu01CX4wE2mmjLHWyEmUVAEfiPVlrVBCjCJFiZBil249D8gLVd WCsFWgKbmZD+qGwcBunJhnBuj+avaFUfJgll3OYDuJccAURUZ2TJQ3iBFfaxHiHO k2tLNcbjkaqd7sOnGUhRrP7DahSGO5M+nOsp/rL4Rx+j+m3iW4G7RGHQr9HL26lv xDW/zMC2xBy3NLgfjJHkNdvhzqSPCSaNw8APA2Xqtmjerw3DnKei9JTz+0cR0hLQ Eg+08rbw5d8usk7g8rD7XWy0VTvDaJd6lhJs7FaTlnBh0e26SR9GKgJOf7UaafiX 76+hwGReKKFRMJ079p1jU5ca2m5L19WL9oIJpjnJQmtWTw4mCY3oksCQ+DtJB92Q a/V3/waNbwZhvzFX9Lv+3iFvPVR6ZUaiMcNRbiaFLzXTSIMROrE= =y8i3 -----END PGP SIGNATURE----- --/3VV2viIDSFvpx07--