pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
11+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2022-05-11 0826ac89ac ca9e9b08e4 b9d70ef34b de6eec10ee f0fb2e9509 5951ad1248 Improve setup of environment values for commands in MSVC's vcregress.pl
* pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
@ 2022-02-15 04:41 Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 11+ messages in thread
From: Michael Paquier @ 2022-02-15 04:41 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Remove command checks in tests of pg_basebackup and pg_receivewal
The TAP tests of those commands have been checking if commands of "gzip"
and "lz4" existed by launching them with an extra --version. Based on
the buildfarm, this is not required for "gzip" as the command always
exists. Since 1d084fb, "lz4" has a ./configure check doing the same
thing.
Reported-by: Andres Freund
Discussion: https://postgr.es/m/20220212220643.ozuvq2k4cjkcnr2v@alap3.anarazel.de
Discussion: https://postgr.es/m/Ygm2ADakjlqGc2Ro@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a4e1deb42b378650aaa2bcb3897caad9fe895957
Modified Files
--------------
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 5 ++---
src/bin/pg_basebackup/t/020_pg_receivewal.pl | 10 ++++------
2 files changed, 6 insertions(+), 9 deletions(-)
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
@ 2022-04-30 20:52 ` Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Dunstan @ 2022-04-30 20:52 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; pgsql-committers@lists.postgresql.org
On 2022-02-14 Mo 23:41, Michael Paquier wrote:
> Remove command checks in tests of pg_basebackup and pg_receivewal
>
> The TAP tests of those commands have been checking if commands of "gzip"
> and "lz4" existed by launching them with an extra --version. Based on
> the buildfarm, this is not required for "gzip" as the command always
> exists. Since 1d084fb, "lz4" has a ./configure check doing the same
> thing.
>
> Reported-by: Andres Freund
> Discussion: https://postgr.es/m/20220212220643.ozuvq2k4cjkcnr2v@alap3.anarazel.de
> Discussion: https://postgr.es/m/Ygm2ADakjlqGc2Ro@paquier.xyz
>
This appears to have been misconceived, at least in the case of MSVC
builds, as I have just discovered. It is entirely possible to have the
lz4 libraries installed and build with them but not have the .exe, and
unlike the configure case the MSVC build system doesn't conduct any test
for it, resulting in a nasty looking TAP test failure. I assume similar
failures are possible with zstd and maybe gzip.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
@ 2022-05-01 13:15 ` Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 11+ messages in thread
From: Michael Paquier @ 2022-05-01 13:15 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org
On Sat, Apr 30, 2022 at 04:52:54PM -0400, Andrew Dunstan wrote:
> This appears to have been misconceived, at least in the case of MSVC
> builds, as I have just discovered. It is entirely possible to have the
> lz4 libraries installed and build with them but not have the .exe, and
> unlike the configure case the MSVC build system doesn't conduct any test
> for it, resulting in a nasty looking TAP test failure. I assume similar
> failures are possible with zstd and maybe gzip.
Okay, we could change the code of vcregress.pl so as the different ENV
commands (tar, zstd, lz4 or gzip) are assigned as follows for the sake
of the tests:
- If a ENV value is available, trust the environment/user and rely on
it.
- If a ENV value is not available, try to look for it in the
environment by launching a simple $command --version (-version should
be fine across all the commands currently in need of coverage?).
-- On failure, set ENV{command} to an empty string.
-- On success, set ENV{command} = "$command"
Does something like this look better to you?
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
@ 2022-05-01 14:18 ` Andrew Dunstan <andrew@dunslane.net>
2022-05-02 07:06 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Dunstan @ 2022-05-01 14:18 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org
On 2022-05-01 Su 09:15, Michael Paquier wrote:
> On Sat, Apr 30, 2022 at 04:52:54PM -0400, Andrew Dunstan wrote:
>> This appears to have been misconceived, at least in the case of MSVC
>> builds, as I have just discovered. It is entirely possible to have the
>> lz4 libraries installed and build with them but not have the .exe, and
>> unlike the configure case the MSVC build system doesn't conduct any test
>> for it, resulting in a nasty looking TAP test failure. I assume similar
>> failures are possible with zstd and maybe gzip.
> Okay, we could change the code of vcregress.pl so as the different ENV
> commands (tar, zstd, lz4 or gzip) are assigned as follows for the sake
> of the tests:
> - If a ENV value is available, trust the environment/user and rely on
> it.
> - If a ENV value is not available, try to look for it in the
> environment by launching a simple $command --version (-version should
> be fine across all the commands currently in need of coverage?).
> -- On failure, set ENV{command} to an empty string.
> -- On success, set ENV{command} = "$command"
>
> Does something like this look better to you?
IIRC we know that tar will be available on Windows.
I don't think we should do that check for every time we call
vc_regress.pl, that seems wasteful. Maybe do it if the command is one
that might require these commands, which I think would be bincheck or
taptest. And/Or stash some status somewhere?
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
@ 2022-05-02 07:06 ` Michael Paquier <michael@paquier.xyz>
2022-05-06 14:12 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 11+ messages in thread
From: Michael Paquier @ 2022-05-02 07:06 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org
On Sun, May 01, 2022 at 10:18:37AM -0400, Andrew Dunstan wrote:
> IIRC we know that tar will be available on Windows.
What about gzip? Are the binaries and the libraries split into
different packages for this package manager on Windows? We've never
assumed that this is possible on ./configure, but it would make sense
to make MSVC able to manage this case.
> I don't think we should do that check for every time we call
> vc_regress.pl, that seems wasteful. Maybe do it if the command is one
> that might require these commands, which I think would be bincheck or
> taptest. And/Or stash some status somewhere?
Mostly. We also care about gzip in contrib/basebackup_to_shell/,
though contribcheck does not run the TAP tests of contrib/ modules.
As you say, setting up those variables in bincheck and taptest would
be enough.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-02 07:06 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
@ 2022-05-06 14:12 ` Andrew Dunstan <andrew@dunslane.net>
2022-05-07 00:13 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Dunstan @ 2022-05-06 14:12 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org
On 2022-05-02 Mo 03:06, Michael Paquier wrote:
> On Sun, May 01, 2022 at 10:18:37AM -0400, Andrew Dunstan wrote:
>> IIRC we know that tar will be available on Windows.
> What about gzip? Are the binaries and the libraries split into
> different packages for this package manager on Windows? We've never
> assumed that this is possible on ./configure, but it would make sense
> to make MSVC able to manage this case.
vcpkg doesn't install any.exe files AFAICS, just DLLs, headers, .lib
files etc.
>
>> I don't think we should do that check for every time we call
>> vc_regress.pl, that seems wasteful. Maybe do it if the command is one
>> that might require these commands, which I think would be bincheck or
>> taptest. And/Or stash some status somewhere?
> Mostly. We also care about gzip in contrib/basebackup_to_shell/,
> though contribcheck does not run the TAP tests of contrib/ modules.
> As you say, setting up those variables in bincheck and taptest would
> be enough.
That would be a start. Maybe meson will us get rid of some of this mess ...
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-02 07:06 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-06 14:12 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
@ 2022-05-07 00:13 ` Michael Paquier <michael@paquier.xyz>
2022-05-09 05:28 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 11+ messages in thread
From: Michael Paquier @ 2022-05-07 00:13 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org
On Fri, May 06, 2022 at 10:12:36AM -0400, Andrew Dunstan wrote:
> On 2022-05-02 Mo 03:06, Michael Paquier wrote:
> vcpkg doesn't install any.exe files AFAICS, just DLLs, headers, .lib
> files etc.
Okay, thanks for confirming.
>>> I don't think we should do that check for every time we call
>>> vc_regress.pl, that seems wasteful. Maybe do it if the command is one
>>> that might require these commands, which I think would be bincheck or
>>> taptest. And/Or stash some status somewhere?
>>
>> Mostly. We also care about gzip in contrib/basebackup_to_shell/,
>> though contribcheck does not run the TAP tests of contrib/ modules.
>> As you say, setting up those variables in bincheck and taptest would
>> be enough.
>
> That would be a start. Maybe meson will us get rid of some of this mess ...
Let's do that for now then as we need a middle ground for HEAD. I'll
come up with something at the beginning of next week.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-02 07:06 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-06 14:12 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-07 00:13 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
@ 2022-05-09 05:28 ` Michael Paquier <michael@paquier.xyz>
2022-05-09 14:10 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 11+ messages in thread
From: Michael Paquier @ 2022-05-09 05:28 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org
Hi Andrew,
On Sat, May 07, 2022 at 09:13:48AM +0900, Michael Paquier wrote:
> Let's do that for now then as we need a middle ground for HEAD. I'll
> come up with something at the beginning of next week.
And here you go as of the attached to show the idea. The CI is able
to execute and detect the default commands for lz4, gzip and zstd,
while one of my boxes without any of those commands would ignore them.
What do you think?
--
Michael
Attachments:
win32-vcregress-env.patch (text/x-diff, 2.3K) download
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index fc7aa8b9a3..6e06686478 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -31,12 +31,11 @@ do './src/tools/msvc/config_default.pl';
do './src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
# 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 +118,41 @@ 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');
+ if ($rc != 0)
+ {
+ # Execution of the default command failed, so reset its
+ # environment value.
+ $ENV{$envname} = '';
+ return;
+ }
+
+ # Set the environment to the default as it exists.
+ $ENV{$envname} = $envdefault;
+ 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 +310,8 @@ sub bincheck
{
InstallTemp();
+ set_command_env();
+
my $mstat = 0;
# Find out all the existing TAP tests by looking for t/ directories
@@ -310,6 +346,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
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-02 07:06 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-06 14:12 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-07 00:13 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-09 05:28 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
@ 2022-05-09 14:10 ` Andrew Dunstan <andrew@dunslane.net>
2022-05-10 00:57 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Dunstan @ 2022-05-09 14:10 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org
On 2022-05-09 Mo 01:28, Michael Paquier wrote:
> Hi Andrew,
>
> On Sat, May 07, 2022 at 09:13:48AM +0900, Michael Paquier wrote:
>> Let's do that for now then as we need a middle ground for HEAD. I'll
>> come up with something at the beginning of next week.
> And here you go as of the attached to show the idea. The CI is able
> to execute and detect the default commands for lz4, gzip and zstd,
> while one of my boxes without any of those commands would ignore them.
> What do you think?
The system() call should include redirection, since we only case about
the return code.
I would just write this
+ if ($rc != 0)
+ {
+ # Execution of the default command failed, so reset its
+ # environment value.
+ $ENV{$envname} = '';
+ return;
+ }
+
+ # Set the environment to the default as it exists.
+ $ENV{$envname} = $envdefault;
+ return;
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.
Otherwise looks good.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-02 07:06 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-06 14:12 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-07 00:13 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-09 05:28 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-09 14:10 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
@ 2022-05-10 00:57 ` Michael Paquier <michael@paquier.xyz>
2022-05-11 01:24 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 11+ messages in thread
From: Michael Paquier @ 2022-05-10 00:57 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-02 07:06 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-06 14:12 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-07 00:13 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-09 05:28 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-05-09 14:10 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Andrew Dunstan <andrew@dunslane.net>
2022-05-10 00:57 ` Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
@ 2022-05-11 01:24 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 11+ messages in thread
From: Michael Paquier @ 2022-05-11 01:24 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org
On Tue, May 10, 2022 at 09:57:29AM +0900, Michael Paquier wrote:
> 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.
The tags have been pushed, so done now.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2022-05-11 01:24 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 04:41 pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa Michael Paquier <michael@paquier.xyz>
2022-04-30 20:52 ` Andrew Dunstan <andrew@dunslane.net>
2022-05-01 13:15 ` Michael Paquier <michael@paquier.xyz>
2022-05-01 14:18 ` Andrew Dunstan <andrew@dunslane.net>
2022-05-02 07:06 ` Michael Paquier <michael@paquier.xyz>
2022-05-06 14:12 ` Andrew Dunstan <andrew@dunslane.net>
2022-05-07 00:13 ` Michael Paquier <michael@paquier.xyz>
2022-05-09 05:28 ` Michael Paquier <michael@paquier.xyz>
2022-05-09 14:10 ` Andrew Dunstan <andrew@dunslane.net>
2022-05-10 00:57 ` Michael Paquier <michael@paquier.xyz>
2022-05-11 01:24 ` Michael Paquier <michael@paquier.xyz>
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