2007-09-23 23:52:56 +02:00
|
|
|
# -*-perl-*- hey - emacs - this is a perl file
|
|
|
|
|
2023-01-02 21:00:37 +01:00
|
|
|
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
|
2021-05-07 16:56:14 +02:00
|
|
|
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/tools/msvc/vcregress.pl
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
use strict;
|
2020-04-13 17:55:45 +02:00
|
|
|
use warnings;
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
our $config;
|
|
|
|
|
|
|
|
use Cwd;
|
2015-07-29 18:17:02 +02:00
|
|
|
use File::Basename;
|
2007-09-23 23:52:56 +02:00
|
|
|
use File::Copy;
|
2015-07-29 18:17:02 +02:00
|
|
|
use File::Find ();
|
2018-08-19 10:12:22 +02:00
|
|
|
use File::Path qw(rmtree);
|
Improve setup of environment values for commands in MSVC's vcregress.pl
The current setup assumes that commands for lz4, zstd and gzip always
exist by default if not enforced by a user's environment. However,
vcpkg, as one example, installs libraries but no binaries, so this
default setup to assume that a command should always be present would
cause failures. This commit improves the detection of such external
commands as follows:
* If a ENV value is available, trust the environment/user and use it.
* If a ENV value is not available, check its execution by looking in the
current PATH, by launching a simple "$command --version" (that should be
portable enough).
** On execution failure, ignore ENV{command}.
** On execution success, set ENV{command} = "$command".
Note that this new rule applies to gzip, lz4 and zstd but not tar that
we assume will always exist. Those commands are set up in the
environment only when using bincheck and taptest. The CI includes all
those commands and I have checked that their setup is correct there. I
have also tested this change in a MSVC environment where we have none of
those commands.
While on it, remove the references to lz4 from the documentation and
vcregress.pl in ~v13. --with-lz4 has been added in v14~ so there is no
point to have this information in these older branches.
Reported-by: Andrew Dunstan
Reviewed-by: Andrew Dunstan
Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net
Backpatch-through: 10
2022-05-11 03:21:52 +02:00
|
|
|
use File::Spec qw(devnull);
|
2020-04-14 22:47:07 +02:00
|
|
|
|
|
|
|
use FindBin;
|
|
|
|
use lib $FindBin::RealBin;
|
2007-09-23 23:52:56 +02:00
|
|
|
|
2012-09-10 18:47:50 +02:00
|
|
|
use Install qw(Install);
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
my $startdir = getcwd();
|
|
|
|
|
|
|
|
chdir "../../.." if (-d "../../../src/tools/msvc");
|
|
|
|
|
2012-09-10 18:47:50 +02:00
|
|
|
my $topdir = getcwd();
|
2015-04-23 14:59:52 +02:00
|
|
|
my $tmp_installdir = "$topdir/tmp_install";
|
2012-09-10 18:47:50 +02:00
|
|
|
|
2019-02-06 00:57:12 +01:00
|
|
|
do './src/tools/msvc/config_default.pl';
|
|
|
|
do './src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
|
2010-03-02 18:06:51 +01:00
|
|
|
|
Improve setup of environment values for commands in MSVC's vcregress.pl
The current setup assumes that commands for lz4, zstd and gzip always
exist by default if not enforced by a user's environment. However,
vcpkg, as one example, installs libraries but no binaries, so this
default setup to assume that a command should always be present would
cause failures. This commit improves the detection of such external
commands as follows:
* If a ENV value is available, trust the environment/user and use it.
* If a ENV value is not available, check its execution by looking in the
current PATH, by launching a simple "$command --version" (that should be
portable enough).
** On execution failure, ignore ENV{command}.
** On execution success, set ENV{command} = "$command".
Note that this new rule applies to gzip, lz4 and zstd but not tar that
we assume will always exist. Those commands are set up in the
environment only when using bincheck and taptest. The CI includes all
those commands and I have checked that their setup is correct there. I
have also tested this change in a MSVC environment where we have none of
those commands.
While on it, remove the references to lz4 from the documentation and
vcregress.pl in ~v13. --with-lz4 has been added in v14~ so there is no
point to have this information in these older branches.
Reported-by: Andrew Dunstan
Reviewed-by: Andrew Dunstan
Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net
Backpatch-through: 10
2022-05-11 03:21:52 +02:00
|
|
|
my $devnull = File::Spec->devnull;
|
|
|
|
|
Adjust behavior of some env settings for the TAP tests of MSVC
edc2332 has introduced in vcregress.pl some control on the environment
variables LZ4, TAR and GZIP_PROGRAM to allow any TAP tests to be able
use those commands. This makes the settings more consistent with
src/Makefile.global.in, as the same default gets used for Make and MSVC
builds.
Each parameter can be changed in buildenv.pl, but as a default gets
assigned after loading buldenv.pl, it is not possible to unset any of
these, and using an empty value would not work with "||=" either. As
some environments may not have a compatible command in their PATH (tar
coming from MinGW is an issue, for one), this could break tests without
an exit path to bypass any failing test. This commit changes things so
as the default values for LZ4, TAR and GZIP_PROGRAM are assigned before
loading buildenv.pl, not after. This way, we keep the same amount of
compatibility as a GNU build with the same defaults, and it becomes
possible to unset any of those values.
While on it, this adds some documentation about those three variables in
the section dedicated to the TAP tests for MSVC.
Per discussion with Andrew Dunstan.
Discussion: https://postgr.es/m/YbGYe483803il3X7@paquier.xyz
Backpatch-through: 10
2021-12-15 02:39:24 +01:00
|
|
|
# These values are defaults that can be overridden by the calling environment
|
Improve setup of environment values for commands in MSVC's vcregress.pl
The current setup assumes that commands for lz4, zstd and gzip always
exist by default if not enforced by a user's environment. However,
vcpkg, as one example, installs libraries but no binaries, so this
default setup to assume that a command should always be present would
cause failures. This commit improves the detection of such external
commands as follows:
* If a ENV value is available, trust the environment/user and use it.
* If a ENV value is not available, check its execution by looking in the
current PATH, by launching a simple "$command --version" (that should be
portable enough).
** On execution failure, ignore ENV{command}.
** On execution success, set ENV{command} = "$command".
Note that this new rule applies to gzip, lz4 and zstd but not tar that
we assume will always exist. Those commands are set up in the
environment only when using bincheck and taptest. The CI includes all
those commands and I have checked that their setup is correct there. I
have also tested this change in a MSVC environment where we have none of
those commands.
While on it, remove the references to lz4 from the documentation and
vcregress.pl in ~v13. --with-lz4 has been added in v14~ so there is no
point to have this information in these older branches.
Reported-by: Andrew Dunstan
Reviewed-by: Andrew Dunstan
Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net
Backpatch-through: 10
2022-05-11 03:21:52 +02:00
|
|
|
# (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.
|
Adjust behavior of some env settings for the TAP tests of MSVC
edc2332 has introduced in vcregress.pl some control on the environment
variables LZ4, TAR and GZIP_PROGRAM to allow any TAP tests to be able
use those commands. This makes the settings more consistent with
src/Makefile.global.in, as the same default gets used for Make and MSVC
builds.
Each parameter can be changed in buildenv.pl, but as a default gets
assigned after loading buldenv.pl, it is not possible to unset any of
these, and using an empty value would not work with "||=" either. As
some environments may not have a compatible command in their PATH (tar
coming from MinGW is an issue, for one), this could break tests without
an exit path to bypass any failing test. This commit changes things so
as the default values for LZ4, TAR and GZIP_PROGRAM are assigned before
loading buildenv.pl, not after. This way, we keep the same amount of
compatibility as a GNU build with the same defaults, and it becomes
possible to unset any of those values.
While on it, this adds some documentation about those three variables in
the section dedicated to the TAP tests for MSVC.
Per discussion with Andrew Dunstan.
Discussion: https://postgr.es/m/YbGYe483803il3X7@paquier.xyz
Backpatch-through: 10
2021-12-15 02:39:24 +01:00
|
|
|
# c.f. src/Makefile.global.in and configure.ac
|
|
|
|
$ENV{TAR} ||= 'tar';
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
# buildenv.pl is for specifying the build environment settings
|
2012-09-10 18:47:50 +02:00
|
|
|
# it should contain lines like:
|
2007-09-23 23:52:56 +02:00
|
|
|
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
|
|
|
|
|
|
|
|
if (-e "src/tools/msvc/buildenv.pl")
|
|
|
|
{
|
2019-02-06 00:57:12 +01:00
|
|
|
do "./src/tools/msvc/buildenv.pl";
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
my $what = shift || "";
|
2012-07-05 03:47:49 +02:00
|
|
|
if ($what =~
|
2018-04-26 17:52:52 +02:00
|
|
|
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
|
2012-09-10 18:47:50 +02:00
|
|
|
)
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
|
|
|
$what = uc $what;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
}
|
|
|
|
|
|
|
|
# use a capital C here because config.pl has $config
|
|
|
|
my $Config = -e "release/postgres/postgres.exe" ? "Release" : "Debug";
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
copy("$Config/refint/refint.dll", "src/test/regress");
|
|
|
|
copy("$Config/autoinc/autoinc.dll", "src/test/regress");
|
|
|
|
copy("$Config/regress/regress.dll", "src/test/regress");
|
|
|
|
copy("$Config/dummy_seclabel/dummy_seclabel.dll", "src/test/regress");
|
2007-09-23 23:52:56 +02:00
|
|
|
|
2021-12-07 20:53:39 +01:00
|
|
|
# Configuration settings used by TAP tests
|
|
|
|
$ENV{with_ssl} = $config->{openssl} ? 'openssl' : 'no';
|
|
|
|
$ENV{with_ldap} = $config->{ldap} ? 'yes' : 'no';
|
|
|
|
$ENV{with_icu} = $config->{icu} ? 'yes' : 'no';
|
|
|
|
$ENV{with_gssapi} = $config->{gss} ? 'yes' : 'no';
|
|
|
|
$ENV{with_krb_srvnam} = $config->{krb_srvnam} || 'postgres';
|
|
|
|
$ENV{with_readline} = 'no';
|
|
|
|
|
2015-07-30 04:48:43 +02:00
|
|
|
$ENV{PATH} = "$topdir/$Config/libpq;$ENV{PATH}";
|
2007-09-23 23:52:56 +02:00
|
|
|
|
2015-11-19 04:47:41 +01:00
|
|
|
if ($ENV{PERL5LIB})
|
|
|
|
{
|
|
|
|
$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$ENV{PERL5LIB} = "$topdir/src/tools/msvc";
|
|
|
|
}
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
my $maxconn = "";
|
2021-05-12 01:17:07 +02:00
|
|
|
$maxconn = "--max-connections=$ENV{MAX_CONNECTIONS}"
|
2007-09-23 23:52:56 +02:00
|
|
|
if $ENV{MAX_CONNECTIONS};
|
|
|
|
|
|
|
|
my $temp_config = "";
|
|
|
|
$temp_config = "--temp-config=\"$ENV{TEMP_CONFIG}\""
|
2010-04-09 15:05:58 +02:00
|
|
|
if $ENV{TEMP_CONFIG};
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
chdir "src/test/regress";
|
|
|
|
|
|
|
|
my %command = (
|
2012-07-05 03:47:49 +02:00
|
|
|
CHECK => \&check,
|
|
|
|
PLCHECK => \&plcheck,
|
|
|
|
INSTALLCHECK => \&installcheck,
|
|
|
|
ECPGCHECK => \&ecpgcheck,
|
|
|
|
CONTRIBCHECK => \&contribcheck,
|
2015-04-17 04:39:52 +02:00
|
|
|
MODULESCHECK => \&modulescheck,
|
2012-09-10 18:47:50 +02:00
|
|
|
ISOLATIONCHECK => \&isolationcheck,
|
2015-11-19 04:47:41 +01:00
|
|
|
BINCHECK => \&bincheck,
|
2016-02-26 20:13:30 +01:00
|
|
|
RECOVERYCHECK => \&recoverycheck,
|
2022-04-02 05:06:11 +02:00
|
|
|
UPGRADECHECK => \&upgradecheck, # no-op
|
2017-05-01 16:12:02 +02:00
|
|
|
TAPTEST => \&taptest,);
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
my $proc = $command{$what};
|
|
|
|
|
|
|
|
exit 3 unless $proc;
|
|
|
|
|
2017-05-02 14:20:11 +02:00
|
|
|
&$proc(@ARGV);
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
exit 0;
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
|
Improve setup of environment values for commands in MSVC's vcregress.pl
The current setup assumes that commands for lz4, zstd and gzip always
exist by default if not enforced by a user's environment. However,
vcpkg, as one example, installs libraries but no binaries, so this
default setup to assume that a command should always be present would
cause failures. This commit improves the detection of such external
commands as follows:
* If a ENV value is available, trust the environment/user and use it.
* If a ENV value is not available, check its execution by looking in the
current PATH, by launching a simple "$command --version" (that should be
portable enough).
** On execution failure, ignore ENV{command}.
** On execution success, set ENV{command} = "$command".
Note that this new rule applies to gzip, lz4 and zstd but not tar that
we assume will always exist. Those commands are set up in the
environment only when using bincheck and taptest. The CI includes all
those commands and I have checked that their setup is correct there. I
have also tested this change in a MSVC environment where we have none of
those commands.
While on it, remove the references to lz4 from the documentation and
vcregress.pl in ~v13. --with-lz4 has been added in v14~ so there is no
point to have this information in these older branches.
Reported-by: Andrew Dunstan
Reviewed-by: Andrew Dunstan
Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net
Backpatch-through: 10
2022-05-11 03:21:52 +02:00
|
|
|
# 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');
|
2022-10-20 21:01:05 +02:00
|
|
|
set_single_env('OPENSSL', 'openssl');
|
Improve setup of environment values for commands in MSVC's vcregress.pl
The current setup assumes that commands for lz4, zstd and gzip always
exist by default if not enforced by a user's environment. However,
vcpkg, as one example, installs libraries but no binaries, so this
default setup to assume that a command should always be present would
cause failures. This commit improves the detection of such external
commands as follows:
* If a ENV value is available, trust the environment/user and use it.
* If a ENV value is not available, check its execution by looking in the
current PATH, by launching a simple "$command --version" (that should be
portable enough).
** On execution failure, ignore ENV{command}.
** On execution success, set ENV{command} = "$command".
Note that this new rule applies to gzip, lz4 and zstd but not tar that
we assume will always exist. Those commands are set up in the
environment only when using bincheck and taptest. The CI includes all
those commands and I have checked that their setup is correct there. I
have also tested this change in a MSVC environment where we have none of
those commands.
While on it, remove the references to lz4 from the documentation and
vcregress.pl in ~v13. --with-lz4 has been added in v14~ so there is no
point to have this information in these older branches.
Reported-by: Andrew Dunstan
Reviewed-by: Andrew Dunstan
Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net
Backpatch-through: 10
2022-05-11 03:21:52 +02:00
|
|
|
set_single_env('ZSTD', 'zstd');
|
|
|
|
}
|
|
|
|
|
In the pg_upgrade test suite, don't write to src/test/regress.
When this suite runs installcheck, redirect file creations from
src/test/regress to src/bin/pg_upgrade/tmp_check/regress. This closes a
race condition in "make -j check-world". If the pg_upgrade suite wrote
to a given src/test/regress/results file in parallel with the regular
src/test/regress invocation writing it, a test failed spuriously. Even
without parallelism, in "make -k check-world", the suite finishing
second overwrote the other's regression.diffs. This revealed test
"largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too.
Buildfarm client REL_10, released fifty-four days ago, supports saving
regression.diffs from its new location. When an older client reports a
pg_upgradeCheck failure, it will no longer include regression.diffs.
Back-patch to 9.5, where pg_upgrade moved to src/bin.
Reviewed (in earlier versions) by Andrew Dunstan.
Discussion: https://postgr.es/m/20181224034411.GA3224776@rfd.leadboat.com
2019-05-28 21:59:00 +02:00
|
|
|
sub installcheck_internal
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
In the pg_upgrade test suite, don't write to src/test/regress.
When this suite runs installcheck, redirect file creations from
src/test/regress to src/bin/pg_upgrade/tmp_check/regress. This closes a
race condition in "make -j check-world". If the pg_upgrade suite wrote
to a given src/test/regress/results file in parallel with the regular
src/test/regress invocation writing it, a test failed spuriously. Even
without parallelism, in "make -k check-world", the suite finishing
second overwrote the other's regression.diffs. This revealed test
"largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too.
Buildfarm client REL_10, released fifty-four days ago, supports saving
regression.diffs from its new location. When an older client reports a
pg_upgradeCheck failure, it will no longer include regression.diffs.
Back-patch to 9.5, where pg_upgrade moved to src/bin.
Reviewed (in earlier versions) by Andrew Dunstan.
Discussion: https://postgr.es/m/20181224034411.GA3224776@rfd.leadboat.com
2019-05-28 21:59:00 +02:00
|
|
|
my ($schedule, @EXTRA_REGRESS_OPTS) = @_;
|
2021-05-11 23:52:04 +02:00
|
|
|
# for backwards compatibility, "serial" runs the tests in
|
|
|
|
# parallel_schedule one by one.
|
|
|
|
my $maxconn = $maxconn;
|
2021-05-12 01:17:07 +02:00
|
|
|
$maxconn = "--max-connections=1" if $schedule eq 'serial';
|
2021-05-11 23:52:04 +02:00
|
|
|
$schedule = 'parallel' if $schedule eq 'serial';
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
my @args = (
|
2012-07-05 03:47:49 +02:00
|
|
|
"../../../$Config/pg_regress/pg_regress",
|
|
|
|
"--dlpath=.",
|
2015-04-23 14:59:52 +02:00
|
|
|
"--bindir=../../../$Config/psql",
|
2012-07-05 03:47:49 +02:00
|
|
|
"--schedule=${schedule}_schedule",
|
2023-02-26 12:48:41 +01:00
|
|
|
"--max-concurrent-tests=20");
|
2012-07-05 03:47:49 +02:00
|
|
|
push(@args, $maxconn) if $maxconn;
|
In the pg_upgrade test suite, don't write to src/test/regress.
When this suite runs installcheck, redirect file creations from
src/test/regress to src/bin/pg_upgrade/tmp_check/regress. This closes a
race condition in "make -j check-world". If the pg_upgrade suite wrote
to a given src/test/regress/results file in parallel with the regular
src/test/regress invocation writing it, a test failed spuriously. Even
without parallelism, in "make -k check-world", the suite finishing
second overwrote the other's regression.diffs. This revealed test
"largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too.
Buildfarm client REL_10, released fifty-four days ago, supports saving
regression.diffs from its new location. When an older client reports a
pg_upgradeCheck failure, it will no longer include regression.diffs.
Back-patch to 9.5, where pg_upgrade moved to src/bin.
Reviewed (in earlier versions) by Andrew Dunstan.
Discussion: https://postgr.es/m/20181224034411.GA3224776@rfd.leadboat.com
2019-05-28 21:59:00 +02:00
|
|
|
push(@args, @EXTRA_REGRESS_OPTS);
|
2007-09-23 23:52:56 +02:00
|
|
|
system(@args);
|
2012-07-05 03:47:49 +02:00
|
|
|
my $status = $? >> 8;
|
2007-09-23 23:52:56 +02:00
|
|
|
exit $status if $status;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
In the pg_upgrade test suite, don't write to src/test/regress.
When this suite runs installcheck, redirect file creations from
src/test/regress to src/bin/pg_upgrade/tmp_check/regress. This closes a
race condition in "make -j check-world". If the pg_upgrade suite wrote
to a given src/test/regress/results file in parallel with the regular
src/test/regress invocation writing it, a test failed spuriously. Even
without parallelism, in "make -k check-world", the suite finishing
second overwrote the other's regression.diffs. This revealed test
"largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too.
Buildfarm client REL_10, released fifty-four days ago, supports saving
regression.diffs from its new location. When an older client reports a
pg_upgradeCheck failure, it will no longer include regression.diffs.
Back-patch to 9.5, where pg_upgrade moved to src/bin.
Reviewed (in earlier versions) by Andrew Dunstan.
Discussion: https://postgr.es/m/20181224034411.GA3224776@rfd.leadboat.com
2019-05-28 21:59:00 +02:00
|
|
|
sub installcheck
|
|
|
|
{
|
|
|
|
my $schedule = shift || 'serial';
|
|
|
|
installcheck_internal($schedule);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
sub check
|
|
|
|
{
|
2017-05-01 16:12:02 +02:00
|
|
|
my $schedule = shift || 'parallel';
|
2023-01-03 14:21:40 +01:00
|
|
|
my $encoding = $ENV{ENCODING} || "SQL_ASCII";
|
2021-05-11 23:52:04 +02:00
|
|
|
# for backwards compatibility, "serial" runs the tests in
|
|
|
|
# parallel_schedule one by one.
|
|
|
|
my $maxconn = $maxconn;
|
2021-05-12 01:17:07 +02:00
|
|
|
$maxconn = "--max-connections=1" if $schedule eq 'serial';
|
2021-05-11 23:52:04 +02:00
|
|
|
$schedule = 'parallel' if $schedule eq 'serial';
|
|
|
|
|
2015-04-23 14:59:52 +02:00
|
|
|
InstallTemp();
|
|
|
|
chdir "${topdir}/src/test/regress";
|
2007-09-23 23:52:56 +02:00
|
|
|
my @args = (
|
2015-07-30 04:48:56 +02:00
|
|
|
"../../../$Config/pg_regress/pg_regress",
|
2012-07-05 03:47:49 +02:00
|
|
|
"--dlpath=.",
|
2015-07-30 04:48:56 +02:00
|
|
|
"--bindir=",
|
2012-07-05 03:47:49 +02:00
|
|
|
"--schedule=${schedule}_schedule",
|
2017-10-07 23:20:09 +02:00
|
|
|
"--max-concurrent-tests=20",
|
2023-01-03 14:21:40 +01:00
|
|
|
"--encoding=${encoding}",
|
2012-07-05 03:47:49 +02:00
|
|
|
"--no-locale",
|
2015-04-23 14:59:52 +02:00
|
|
|
"--temp-instance=./tmp_check");
|
2012-07-05 03:47:49 +02:00
|
|
|
push(@args, $maxconn) if $maxconn;
|
|
|
|
push(@args, $temp_config) if $temp_config;
|
2007-09-23 23:52:56 +02:00
|
|
|
system(@args);
|
2012-07-05 03:47:49 +02:00
|
|
|
my $status = $? >> 8;
|
2007-09-23 23:52:56 +02:00
|
|
|
exit $status if $status;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sub ecpgcheck
|
|
|
|
{
|
2017-05-01 16:12:02 +02:00
|
|
|
my $msbflags = $ENV{MSBFLAGS} || "";
|
2007-09-23 23:52:56 +02:00
|
|
|
chdir $startdir;
|
2016-09-08 07:42:09 +02:00
|
|
|
system("msbuild ecpg_regression.proj $msbflags /p:config=$Config");
|
2012-07-05 03:47:49 +02:00
|
|
|
my $status = $? >> 8;
|
2007-09-23 23:52:56 +02:00
|
|
|
exit $status if $status;
|
2015-04-23 14:59:52 +02:00
|
|
|
InstallTemp();
|
2007-09-23 23:52:56 +02:00
|
|
|
chdir "$topdir/src/interfaces/ecpg/test";
|
2017-05-01 16:12:02 +02:00
|
|
|
my $schedule = "ecpg";
|
|
|
|
my @args = (
|
2015-07-30 04:48:56 +02:00
|
|
|
"../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
|
2015-04-23 14:59:52 +02:00
|
|
|
"--bindir=",
|
2016-07-18 00:42:31 +02:00
|
|
|
"--dbname=ecpg1_regression,ecpg2_regression",
|
|
|
|
"--create-role=regress_ecpg_user1,regress_ecpg_user2",
|
2007-09-23 23:52:56 +02:00
|
|
|
"--schedule=${schedule}_schedule",
|
2011-04-15 07:42:05 +02:00
|
|
|
"--encoding=SQL_ASCII",
|
2007-09-23 23:52:56 +02:00
|
|
|
"--no-locale",
|
2015-04-23 14:59:52 +02:00
|
|
|
"--temp-instance=./tmp_chk");
|
2012-07-05 03:47:49 +02:00
|
|
|
push(@args, $maxconn) if $maxconn;
|
2007-09-23 23:52:56 +02:00
|
|
|
system(@args);
|
2012-07-05 03:47:49 +02:00
|
|
|
$status = $? >> 8;
|
2007-09-23 23:52:56 +02:00
|
|
|
exit $status if $status;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
2011-05-15 23:55:05 +02:00
|
|
|
sub isolationcheck
|
|
|
|
{
|
2015-07-30 04:48:56 +02:00
|
|
|
chdir "../isolation";
|
|
|
|
copy("../../../$Config/isolationtester/isolationtester.exe",
|
|
|
|
"../../../$Config/pg_isolation_regress");
|
2011-05-15 23:55:05 +02:00
|
|
|
my @args = (
|
2015-07-30 04:48:56 +02:00
|
|
|
"../../../$Config/pg_isolation_regress/pg_isolation_regress",
|
|
|
|
"--bindir=../../../$Config/psql",
|
2012-07-05 03:47:49 +02:00
|
|
|
"--inputdir=.",
|
|
|
|
"--schedule=./isolation_schedule");
|
|
|
|
push(@args, $maxconn) if $maxconn;
|
2011-05-15 23:55:05 +02:00
|
|
|
system(@args);
|
2012-07-05 03:47:49 +02:00
|
|
|
my $status = $? >> 8;
|
2011-05-15 23:55:05 +02:00
|
|
|
exit $status if $status;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2011-05-15 23:55:05 +02:00
|
|
|
}
|
|
|
|
|
2015-11-19 04:47:41 +01:00
|
|
|
sub tap_check
|
2015-07-29 18:17:02 +02:00
|
|
|
{
|
2015-11-19 04:47:41 +01:00
|
|
|
die "Tap tests not enabled in configuration"
|
|
|
|
unless $config->{tap_tests};
|
|
|
|
|
2017-06-10 16:19:06 +02:00
|
|
|
my @flags;
|
2020-06-08 01:27:13 +02:00
|
|
|
foreach my $arg (0 .. scalar(@_) - 1)
|
2017-06-10 16:19:06 +02:00
|
|
|
{
|
|
|
|
next unless $_[$arg] =~ /^PROVE_FLAGS=(.*)/;
|
|
|
|
@flags = split(/\s+/, $1);
|
|
|
|
splice(@_, $arg, 1);
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
|
2015-11-19 04:47:41 +01:00
|
|
|
my $dir = shift;
|
|
|
|
chdir $dir;
|
2015-07-29 18:17:02 +02:00
|
|
|
|
2021-03-05 02:12:49 +01:00
|
|
|
# Fetch and adjust PROVE_TESTS, applying glob() to each element
|
|
|
|
# defined to build a list of all the tests matching patterns.
|
|
|
|
my $prove_tests_val = $ENV{PROVE_TESTS} || "t/*.pl";
|
|
|
|
my @prove_tests_array = split(/\s+/, $prove_tests_val);
|
|
|
|
my @prove_tests = ();
|
|
|
|
foreach (@prove_tests_array)
|
|
|
|
{
|
|
|
|
push(@prove_tests, glob($_));
|
|
|
|
}
|
|
|
|
|
|
|
|
# Fetch and adjust PROVE_FLAGS, handling multiple arguments.
|
|
|
|
my $prove_flags_val = $ENV{PROVE_FLAGS} || "";
|
|
|
|
my @prove_flags = split(/\s+/, $prove_flags_val);
|
|
|
|
|
|
|
|
my @args = ("prove", @flags, @prove_tests, @prove_flags);
|
2015-07-29 18:17:02 +02:00
|
|
|
|
2015-11-19 04:47:41 +01:00
|
|
|
# adjust the environment for just this test
|
|
|
|
local %ENV = %ENV;
|
2015-07-29 18:17:02 +02:00
|
|
|
$ENV{PERL5LIB} = "$topdir/src/test/perl;$ENV{PERL5LIB}";
|
|
|
|
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
|
2019-04-13 07:36:38 +02:00
|
|
|
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
|
2015-07-29 18:17:02 +02:00
|
|
|
|
2022-09-20 03:03:17 +02:00
|
|
|
$ENV{TESTDATADIR} = "$dir/tmp_check";
|
|
|
|
$ENV{TESTLOGDIR} = "$dir/tmp_check/log";
|
|
|
|
|
2021-10-22 15:11:52 +02:00
|
|
|
my $module = basename $dir;
|
|
|
|
# add the module build dir as the second element in the PATH
|
|
|
|
$ENV{PATH} =~ s!;!;$topdir/$Config/$module;!;
|
2015-11-19 04:47:41 +01:00
|
|
|
|
2018-08-19 10:12:22 +02:00
|
|
|
rmtree('tmp_check');
|
2015-11-19 04:47:41 +01:00
|
|
|
system(@args);
|
|
|
|
my $status = $? >> 8;
|
|
|
|
return $status;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub bincheck
|
|
|
|
{
|
|
|
|
InstallTemp();
|
|
|
|
|
Improve setup of environment values for commands in MSVC's vcregress.pl
The current setup assumes that commands for lz4, zstd and gzip always
exist by default if not enforced by a user's environment. However,
vcpkg, as one example, installs libraries but no binaries, so this
default setup to assume that a command should always be present would
cause failures. This commit improves the detection of such external
commands as follows:
* If a ENV value is available, trust the environment/user and use it.
* If a ENV value is not available, check its execution by looking in the
current PATH, by launching a simple "$command --version" (that should be
portable enough).
** On execution failure, ignore ENV{command}.
** On execution success, set ENV{command} = "$command".
Note that this new rule applies to gzip, lz4 and zstd but not tar that
we assume will always exist. Those commands are set up in the
environment only when using bincheck and taptest. The CI includes all
those commands and I have checked that their setup is correct there. I
have also tested this change in a MSVC environment where we have none of
those commands.
While on it, remove the references to lz4 from the documentation and
vcregress.pl in ~v13. --with-lz4 has been added in v14~ so there is no
point to have this information in these older branches.
Reported-by: Andrew Dunstan
Reviewed-by: Andrew Dunstan
Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net
Backpatch-through: 10
2022-05-11 03:21:52 +02:00
|
|
|
set_command_env();
|
|
|
|
|
2015-11-19 04:47:41 +01:00
|
|
|
my $mstat = 0;
|
|
|
|
|
2015-07-29 18:17:02 +02:00
|
|
|
# Find out all the existing TAP tests by looking for t/ directories
|
|
|
|
# in the tree.
|
2015-11-19 04:47:41 +01:00
|
|
|
my @bin_dirs = glob("$topdir/src/bin/*");
|
2015-07-29 18:17:02 +02:00
|
|
|
|
|
|
|
# Process each test
|
2015-11-19 08:42:02 +01:00
|
|
|
foreach my $dir (@bin_dirs)
|
2015-07-29 18:17:02 +02:00
|
|
|
{
|
2015-11-19 04:47:41 +01:00
|
|
|
next unless -d "$dir/t";
|
Switch the regression tests of pg_upgrade to use TAP tests
This simplifies a lot of code in the tests of pg_upgrade without
sacrificing its coverage:
- Removal of test.sh used for builds with make, that has accumulated
over the years tweaks for problems that are solved in a duplicated way
by the centralized TAP framework (initialization of the various
environment variables PG*, port selection).
- Removal of the code in MSVC to test pg_upgrade. This was roughly a
duplicate of test.sh adapted for Windows, with an extra footprint of
a pg_regress command and all the assumptions behind it.
Support for upgrades with older versions is changed, not removed.
test.sh was able to set up the regression database on the old instance
by launching itself the pg_regress command and a dependency to the
source tree of thd old cluster, with tweaks on the command arguments to
adapt across the versions used. This created a backward-compatibility
dependency with older pg_regress commands, and recent changes like
d1029bb have made that much more complicated.
Instead, this commit allows tests with older major versions by
specifying a path to a SQL dump (taken with pg_dumpall from the old
cluster's installation) that will be loaded into the old instance to
upgrade instead of running pg_regress, through an optional environment
variable called $olddump. This requires a second variable called
$oldinstall to point to the base path of the installation of the old
cluster. This method is more in line with the buildfarm client that
uses a set of static dumps to set up an old instance, so hopefully we
will be able to reuse what is introduced in this commit there. The last
step of the tests that checks for differences between the two dumps
taken still needs to be improved as it can fail, requiring a manual
lookup at the dumps. This is not different from the old way of testing
where things could fail at the last step.
Support for EXTRA_REGRESS_OPTS is kept. vcregress.pl in the MSVC
scripts still handles the test of pg_upgrade with its upgradecheck, and
bincheck is changed to skip pg_upgrade.
Author: Michael Paquier
Reviewed-by: Andrew Dunstan, Andres Freund, Rachel Heaton, Tom Lane,
Discussion: https://postgr.es/m/YJ8xTmLQkotVLpN5@paquier.xyz
2022-04-01 03:13:50 +02:00
|
|
|
|
2015-11-19 04:47:41 +01:00
|
|
|
my $status = tap_check($dir);
|
2015-07-30 04:48:56 +02:00
|
|
|
$mstat ||= $status;
|
2015-07-29 18:17:02 +02:00
|
|
|
}
|
2015-07-30 04:48:56 +02:00
|
|
|
exit $mstat if $mstat;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2015-07-29 18:17:02 +02:00
|
|
|
}
|
|
|
|
|
2017-05-01 16:12:02 +02:00
|
|
|
sub taptest
|
|
|
|
{
|
|
|
|
my $dir = shift;
|
2017-07-16 17:24:29 +02:00
|
|
|
my @args;
|
|
|
|
|
|
|
|
if ($dir =~ /^PROVE_FLAGS=/)
|
|
|
|
{
|
|
|
|
push(@args, $dir);
|
|
|
|
$dir = shift;
|
|
|
|
}
|
2017-05-01 16:12:02 +02:00
|
|
|
|
|
|
|
die "no tests found!" unless -d "$topdir/$dir/t";
|
|
|
|
|
2017-07-16 18:00:23 +02:00
|
|
|
push(@args, "$topdir/$dir");
|
2017-07-16 17:24:29 +02:00
|
|
|
|
2017-05-01 16:12:02 +02:00
|
|
|
InstallTemp();
|
Improve setup of environment values for commands in MSVC's vcregress.pl
The current setup assumes that commands for lz4, zstd and gzip always
exist by default if not enforced by a user's environment. However,
vcpkg, as one example, installs libraries but no binaries, so this
default setup to assume that a command should always be present would
cause failures. This commit improves the detection of such external
commands as follows:
* If a ENV value is available, trust the environment/user and use it.
* If a ENV value is not available, check its execution by looking in the
current PATH, by launching a simple "$command --version" (that should be
portable enough).
** On execution failure, ignore ENV{command}.
** On execution success, set ENV{command} = "$command".
Note that this new rule applies to gzip, lz4 and zstd but not tar that
we assume will always exist. Those commands are set up in the
environment only when using bincheck and taptest. The CI includes all
those commands and I have checked that their setup is correct there. I
have also tested this change in a MSVC environment where we have none of
those commands.
While on it, remove the references to lz4 from the documentation and
vcregress.pl in ~v13. --with-lz4 has been added in v14~ so there is no
point to have this information in these older branches.
Reported-by: Andrew Dunstan
Reviewed-by: Andrew Dunstan
Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net
Backpatch-through: 10
2022-05-11 03:21:52 +02:00
|
|
|
|
|
|
|
set_command_env();
|
|
|
|
|
2017-07-16 17:24:29 +02:00
|
|
|
my $status = tap_check(@args);
|
2017-05-01 16:12:02 +02:00
|
|
|
exit $status if $status;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2017-05-01 16:12:02 +02:00
|
|
|
}
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
sub plcheck
|
|
|
|
{
|
2017-12-07 20:03:29 +01:00
|
|
|
chdir "$topdir/src/pl";
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2017-12-07 20:03:29 +01:00
|
|
|
foreach my $dir (glob("*/src *"))
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
2017-12-07 20:03:29 +01:00
|
|
|
next unless -d "$dir/sql" && -d "$dir/expected";
|
|
|
|
my $lang;
|
|
|
|
if ($dir eq 'plpgsql/src')
|
|
|
|
{
|
|
|
|
$lang = 'plpgsql';
|
|
|
|
}
|
|
|
|
elsif ($dir eq 'tcl')
|
|
|
|
{
|
|
|
|
$lang = 'pltcl';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$lang = $dir;
|
|
|
|
}
|
2014-04-16 19:35:46 +02:00
|
|
|
if ($lang eq 'plpython')
|
|
|
|
{
|
2018-05-09 16:04:17 +02:00
|
|
|
next
|
2022-03-08 03:19:56 +01:00
|
|
|
unless -d "$topdir/$Config/plpython3";
|
2014-04-16 19:35:46 +02:00
|
|
|
$lang = 'plpythonu';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-12-07 20:03:29 +01:00
|
|
|
next unless -d "$topdir/$Config/$lang";
|
2014-04-16 19:35:46 +02:00
|
|
|
}
|
2011-03-05 03:51:14 +01:00
|
|
|
my @lang_args = ("--load-extension=$lang");
|
2017-12-07 20:03:29 +01:00
|
|
|
chdir $dir;
|
2010-01-09 16:25:41 +01:00
|
|
|
my @tests = fetchTests();
|
2010-04-09 15:05:58 +02:00
|
|
|
if ($lang eq 'plperl')
|
|
|
|
{
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2020-01-30 01:13:34 +01:00
|
|
|
# plperl tests will install the extensions themselves
|
|
|
|
@lang_args = ();
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2010-04-09 15:05:58 +02:00
|
|
|
# assume we're using this perl to built postgres
|
|
|
|
# test if we can run two interpreters in one backend, and if so
|
|
|
|
# run the trusted/untrusted interaction tests
|
|
|
|
use Config;
|
|
|
|
if ($Config{usemultiplicity} eq 'define')
|
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
push(@tests, 'plperl_plperlu');
|
2010-04-09 15:05:58 +02:00
|
|
|
}
|
|
|
|
}
|
2018-05-04 21:22:48 +02:00
|
|
|
elsif ($lang eq 'plpythonu' && -d "$topdir/$Config/plpython3")
|
|
|
|
{
|
|
|
|
@lang_args = ();
|
|
|
|
}
|
2018-11-29 02:31:12 +01:00
|
|
|
|
|
|
|
# Move on if no tests are listed.
|
|
|
|
next if (scalar @tests == 0);
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
print
|
|
|
|
"============================================================\n";
|
2007-09-23 23:52:56 +02:00
|
|
|
print "Checking $lang\n";
|
|
|
|
my @args = (
|
2017-12-07 20:03:29 +01:00
|
|
|
"$topdir/$Config/pg_regress/pg_regress",
|
|
|
|
"--bindir=$topdir/$Config/psql",
|
2012-07-05 03:47:49 +02:00
|
|
|
"--dbname=pl_regression", @lang_args, @tests);
|
2007-09-23 23:52:56 +02:00
|
|
|
system(@args);
|
|
|
|
my $status = $? >> 8;
|
|
|
|
exit $status if $status;
|
2017-12-07 20:03:29 +01:00
|
|
|
chdir "$topdir/src/pl";
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2017-12-07 20:03:29 +01:00
|
|
|
chdir "$topdir";
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
2015-04-17 04:39:52 +02:00
|
|
|
sub subdircheck
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
2015-04-17 04:39:52 +02:00
|
|
|
my $module = shift;
|
|
|
|
|
|
|
|
if ( !-d "$module/sql"
|
|
|
|
|| !-d "$module/expected"
|
|
|
|
|| (!-f "$module/GNUmakefile" && !-f "$module/Makefile"))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2015-04-29 19:49:24 +02:00
|
|
|
|
2015-04-17 04:39:52 +02:00
|
|
|
chdir $module;
|
2015-04-29 19:49:24 +02:00
|
|
|
my @tests = fetchTests();
|
2018-11-29 02:31:12 +01:00
|
|
|
|
|
|
|
# Leave if no tests are listed in the module.
|
|
|
|
if (scalar @tests == 0)
|
|
|
|
{
|
|
|
|
chdir "..";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-29 19:49:24 +02:00
|
|
|
my @opts = fetchRegressOpts();
|
|
|
|
|
2015-04-17 04:39:52 +02:00
|
|
|
print "============================================================\n";
|
|
|
|
print "Checking $module\n";
|
|
|
|
my @args = (
|
2015-07-30 04:48:56 +02:00
|
|
|
"$topdir/$Config/pg_regress/pg_regress",
|
|
|
|
"--bindir=${topdir}/${Config}/psql",
|
2015-04-17 04:39:52 +02:00
|
|
|
"--dbname=contrib_regression", @opts, @tests);
|
2018-05-09 16:04:17 +02:00
|
|
|
print join(' ', @args), "\n";
|
2015-04-17 04:39:52 +02:00
|
|
|
system(@args);
|
|
|
|
chdir "..";
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2015-04-17 04:39:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sub contribcheck
|
|
|
|
{
|
2015-07-30 04:48:56 +02:00
|
|
|
chdir "../../../contrib";
|
|
|
|
my $mstat = 0;
|
2007-09-23 23:52:56 +02:00
|
|
|
foreach my $module (glob("*"))
|
|
|
|
{
|
2014-05-28 04:31:21 +02:00
|
|
|
# these configuration-based exclusions must match Install.pm
|
2018-05-09 16:04:17 +02:00
|
|
|
next if ($module eq "uuid-ossp" && !defined($config->{uuid}));
|
|
|
|
next if ($module eq "sslinfo" && !defined($config->{openssl}));
|
2022-01-07 21:48:53 +01:00
|
|
|
next if ($module eq "pgcrypto" && !defined($config->{openssl}));
|
2018-05-09 16:04:17 +02:00
|
|
|
next if ($module eq "xml2" && !defined($config->{xml}));
|
|
|
|
next if ($module =~ /_plperl$/ && !defined($config->{perl}));
|
|
|
|
next if ($module =~ /_plpython$/ && !defined($config->{python}));
|
2014-05-28 04:31:21 +02:00
|
|
|
next if ($module eq "sepgsql");
|
|
|
|
|
2018-05-04 21:22:48 +02:00
|
|
|
subdircheck($module);
|
2015-07-30 04:48:56 +02:00
|
|
|
my $status = $? >> 8;
|
|
|
|
$mstat ||= $status;
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
2015-07-30 04:48:56 +02:00
|
|
|
exit $mstat if $mstat;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
2015-04-17 04:39:52 +02:00
|
|
|
sub modulescheck
|
|
|
|
{
|
2015-07-30 04:48:56 +02:00
|
|
|
chdir "../../../src/test/modules";
|
|
|
|
my $mstat = 0;
|
2015-04-17 04:39:52 +02:00
|
|
|
foreach my $module (glob("*"))
|
|
|
|
{
|
2018-05-04 21:22:48 +02:00
|
|
|
subdircheck($module);
|
2015-07-30 04:48:56 +02:00
|
|
|
my $status = $? >> 8;
|
|
|
|
$mstat ||= $status;
|
2015-04-17 04:39:52 +02:00
|
|
|
}
|
2015-07-30 04:48:56 +02:00
|
|
|
exit $mstat if $mstat;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2015-04-17 04:39:52 +02:00
|
|
|
}
|
|
|
|
|
2016-02-26 20:13:30 +01:00
|
|
|
sub recoverycheck
|
|
|
|
{
|
|
|
|
InstallTemp();
|
|
|
|
|
|
|
|
my $dir = "$topdir/src/test/recovery";
|
|
|
|
my $status = tap_check($dir);
|
|
|
|
exit $status if $status;
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2016-02-26 20:13:30 +01:00
|
|
|
}
|
|
|
|
|
2014-12-18 04:48:40 +01:00
|
|
|
# Run "initdb", then reconfigure authentication.
|
|
|
|
sub standard_initdb
|
|
|
|
{
|
|
|
|
return (
|
2015-07-30 04:48:56 +02:00
|
|
|
system('initdb', '-N') == 0 and system(
|
|
|
|
"$topdir/$Config/pg_regress/pg_regress", '--config-auth',
|
2014-12-18 04:48:40 +01:00
|
|
|
$ENV{PGDATA}) == 0);
|
|
|
|
}
|
|
|
|
|
2016-08-08 16:07:46 +02:00
|
|
|
# This is similar to appendShellString(). Perl system(@args) bypasses
|
|
|
|
# cmd.exe, so omit the caret escape layer.
|
|
|
|
sub quote_system_arg
|
|
|
|
{
|
|
|
|
my $arg = shift;
|
|
|
|
|
|
|
|
# Change N >= 0 backslashes before a double quote to 2N+1 backslashes.
|
|
|
|
$arg =~ s/(\\*)"/${\($1 . $1)}\\"/gs;
|
|
|
|
|
|
|
|
# Change N >= 1 backslashes at end of argument to 2N backslashes.
|
|
|
|
$arg =~ s/(\\+)$/${\($1 . $1)}/gs;
|
|
|
|
|
|
|
|
# Wrap the whole thing in unescaped double quotes.
|
|
|
|
return "\"$arg\"";
|
|
|
|
}
|
|
|
|
|
2012-09-10 18:47:50 +02:00
|
|
|
sub upgradecheck
|
|
|
|
{
|
2022-04-02 05:06:11 +02:00
|
|
|
# pg_upgrade is now handled by bincheck, but keep this target for
|
|
|
|
# backward compatibility.
|
|
|
|
print "upgradecheck is a no-op, use bincheck instead.\n";
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2012-09-10 18:47:50 +02:00
|
|
|
}
|
|
|
|
|
2009-08-19 00:36:56 +02:00
|
|
|
sub fetchRegressOpts
|
|
|
|
{
|
|
|
|
my $handle;
|
2017-03-27 04:24:13 +02:00
|
|
|
open($handle, '<', "GNUmakefile")
|
|
|
|
|| open($handle, '<', "Makefile")
|
2009-08-19 00:36:56 +02:00
|
|
|
|| die "Could not open Makefile";
|
2012-07-05 03:47:49 +02:00
|
|
|
local ($/) = undef;
|
2009-08-19 00:36:56 +02:00
|
|
|
my $m = <$handle>;
|
|
|
|
close($handle);
|
2010-04-09 15:05:58 +02:00
|
|
|
my @opts;
|
2014-12-18 09:55:17 +01:00
|
|
|
|
|
|
|
$m =~ s{\\\r?\n}{}g;
|
2015-05-18 19:40:06 +02:00
|
|
|
if ($m =~ /^\s*REGRESS_OPTS\s*\+?=(.*)/m)
|
2010-04-09 15:05:58 +02:00
|
|
|
{
|
2017-05-18 01:01:23 +02:00
|
|
|
|
2014-07-23 06:35:07 +02:00
|
|
|
# Substitute known Makefile variables, then ignore options that retain
|
|
|
|
# an unhandled variable reference. Ignore anything that isn't an
|
|
|
|
# option starting with "--".
|
2017-03-28 15:00:59 +02:00
|
|
|
@opts = grep { !/\$\(/ && /^--/ }
|
|
|
|
map { (my $x = $_) =~ s/\Q$(top_builddir)\E/\"$topdir\"/; $x; }
|
|
|
|
split(/\s+/, $1);
|
2010-04-09 15:05:58 +02:00
|
|
|
}
|
2011-04-19 21:52:52 +02:00
|
|
|
if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m)
|
|
|
|
{
|
|
|
|
push @opts, "--encoding=$1";
|
|
|
|
}
|
|
|
|
if ($m =~ /^\s*NO_LOCALE\s*=\s*\S+/m)
|
|
|
|
{
|
|
|
|
push @opts, "--no-locale";
|
|
|
|
}
|
2010-04-09 15:05:58 +02:00
|
|
|
return @opts;
|
2009-08-19 00:36:56 +02:00
|
|
|
}
|
|
|
|
|
2018-11-29 02:31:12 +01:00
|
|
|
# Fetch the list of tests by parsing a module's Makefile. An empty
|
|
|
|
# list is returned if the module does not need to run anything.
|
2007-09-23 23:52:56 +02:00
|
|
|
sub fetchTests
|
|
|
|
{
|
|
|
|
my $handle;
|
2017-03-27 04:24:13 +02:00
|
|
|
open($handle, '<', "GNUmakefile")
|
|
|
|
|| open($handle, '<', "Makefile")
|
2007-09-23 23:52:56 +02:00
|
|
|
|| die "Could not open Makefile";
|
2012-07-05 03:47:49 +02:00
|
|
|
local ($/) = undef;
|
2007-09-23 23:52:56 +02:00
|
|
|
my $m = <$handle>;
|
|
|
|
close($handle);
|
|
|
|
my $t = "";
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2014-07-14 20:07:27 +02:00
|
|
|
$m =~ s{\\\r?\n}{}g;
|
2018-11-29 02:31:12 +01:00
|
|
|
|
|
|
|
# A module specifying NO_INSTALLCHECK does not support installcheck,
|
|
|
|
# so bypass its run by returning an empty set of tests.
|
|
|
|
if ($m =~ /^\s*NO_INSTALLCHECK\s*=\s*\S+/m)
|
|
|
|
{
|
|
|
|
return ();
|
|
|
|
}
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
|
|
|
|
{
|
|
|
|
$t = $1;
|
|
|
|
$t =~ s/\s+/ /g;
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
if ($m =~ /contrib\/pgcrypto/)
|
|
|
|
{
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2021-11-05 13:59:42 +01:00
|
|
|
# pgcrypto is special since some tests depend on the
|
2007-09-23 23:52:56 +02:00
|
|
|
# configuration of the build
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
my $pgptests =
|
|
|
|
$config->{zlib}
|
2012-07-05 03:47:49 +02:00
|
|
|
? GetTests("ZLIB_TST", $m)
|
|
|
|
: GetTests("ZLIB_OFF_TST", $m);
|
2007-09-23 23:52:56 +02:00
|
|
|
$t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
|
|
|
|
}
|
|
|
|
}
|
2012-06-10 21:20:04 +02:00
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
return split(/\s+/, $t);
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sub GetTests
|
|
|
|
{
|
|
|
|
my $testname = shift;
|
2012-07-05 03:47:49 +02:00
|
|
|
my $m = shift;
|
2007-09-23 23:52:56 +02:00
|
|
|
if ($m =~ /^$testname\s*=\s*(.*)$/gm)
|
|
|
|
{
|
|
|
|
return $1;
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2015-04-23 14:59:52 +02:00
|
|
|
sub InstallTemp
|
|
|
|
{
|
2017-05-01 16:12:02 +02:00
|
|
|
unless ($ENV{NO_TEMP_INSTALL})
|
|
|
|
{
|
|
|
|
print "Setting up temp install\n\n";
|
|
|
|
Install("$tmp_installdir", "all", $config);
|
|
|
|
}
|
2015-07-30 04:48:56 +02:00
|
|
|
$ENV{PATH} = "$tmp_installdir/bin;$ENV{PATH}";
|
2018-05-27 15:08:42 +02:00
|
|
|
return;
|
2015-04-23 14:59:52 +02:00
|
|
|
}
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
sub usage
|
|
|
|
{
|
|
|
|
print STDERR
|
2022-01-25 01:40:04 +01:00
|
|
|
"Usage: vcregress.pl <mode> [<arg>]\n\n",
|
2016-04-15 10:04:10 +02:00
|
|
|
"Options for <mode>:\n",
|
|
|
|
" bincheck run tests of utilities in src/bin/\n",
|
|
|
|
" check deploy instance and run regression tests on it\n",
|
|
|
|
" contribcheck run tests of modules in contrib/\n",
|
|
|
|
" ecpgcheck run regression tests of ECPG\n",
|
|
|
|
" installcheck run regression tests on existing instance\n",
|
|
|
|
" isolationcheck run isolation tests\n",
|
|
|
|
" modulescheck run tests of modules in src/test/modules/\n",
|
|
|
|
" plcheck run tests of PL languages\n",
|
|
|
|
" recoverycheck run recovery test suite\n",
|
2017-05-01 16:12:02 +02:00
|
|
|
" taptest run an arbitrary TAP test set\n",
|
2022-04-02 05:06:11 +02:00
|
|
|
" upgradecheck run tests of pg_upgrade (no-op)\n",
|
2017-05-01 16:12:02 +02:00
|
|
|
"\nOptions for <arg>: (used by check and installcheck)\n",
|
2016-04-15 10:04:10 +02:00
|
|
|
" serial serial mode\n",
|
2017-05-01 16:12:02 +02:00
|
|
|
" parallel parallel mode\n",
|
|
|
|
"\nOption for <arg>: for taptest\n",
|
|
|
|
" TEST_DIR (required) directory where tests reside\n";
|
2010-04-09 15:05:58 +02:00
|
|
|
exit(1);
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|