Skip to content
Snippets Groups Projects
Commit fed6df48 authored by Andrew Dunstan's avatar Andrew Dunstan
Browse files

Allow vcregress.pl to run an arbitrary TAP test set

Currently only provision for running the bin checks in a single step is
provided for. Now these tests can be run individually, as well as tests
in other locations (e.g. src.test/recover).

Also provide for suppressing unnecessary temp installs by setting the
NO_TEMP_INSTALL environment variable just as the Makefiles do.

Backpatch to 9.4.
parent 9414e41e
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ if (-e "src/tools/msvc/buildenv.pl") ...@@ -34,7 +34,7 @@ if (-e "src/tools/msvc/buildenv.pl")
my $what = shift || ""; my $what = shift || "";
if ($what =~ if ($what =~
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck)$/i /^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
) )
{ {
$what = uc $what; $what = uc $what;
...@@ -54,13 +54,6 @@ copy("$Config/dummy_seclabel/dummy_seclabel.dll", "src/test/regress"); ...@@ -54,13 +54,6 @@ copy("$Config/dummy_seclabel/dummy_seclabel.dll", "src/test/regress");
$ENV{PATH} = "$topdir/$Config/libpq;$ENV{PATH}"; $ENV{PATH} = "$topdir/$Config/libpq;$ENV{PATH}";
my $schedule = shift;
unless ($schedule)
{
$schedule = "serial";
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
}
if ($ENV{PERL5LIB}) if ($ENV{PERL5LIB})
{ {
$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}"; $ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
...@@ -90,13 +83,14 @@ my %command = ( ...@@ -90,13 +83,14 @@ my %command = (
ISOLATIONCHECK => \&isolationcheck, ISOLATIONCHECK => \&isolationcheck,
BINCHECK => \&bincheck, BINCHECK => \&bincheck,
RECOVERYCHECK => \&recoverycheck, RECOVERYCHECK => \&recoverycheck,
UPGRADECHECK => \&upgradecheck,); UPGRADECHECK => \&upgradecheck,
TAPTEST => \&taptest,);
my $proc = $command{$what}; my $proc = $command{$what};
exit 3 unless $proc; exit 3 unless $proc;
&$proc(); &$proc(@_);
exit 0; exit 0;
...@@ -104,6 +98,7 @@ exit 0; ...@@ -104,6 +98,7 @@ exit 0;
sub installcheck sub installcheck
{ {
my $schedule = shift || 'serial';
my @args = ( my @args = (
"../../../$Config/pg_regress/pg_regress", "../../../$Config/pg_regress/pg_regress",
"--dlpath=.", "--dlpath=.",
...@@ -119,6 +114,7 @@ sub installcheck ...@@ -119,6 +114,7 @@ sub installcheck
sub check sub check
{ {
my $schedule = shift || 'parallel';
InstallTemp(); InstallTemp();
chdir "${topdir}/src/test/regress"; chdir "${topdir}/src/test/regress";
my @args = ( my @args = (
...@@ -145,7 +141,7 @@ sub ecpgcheck ...@@ -145,7 +141,7 @@ sub ecpgcheck
exit $status if $status; exit $status if $status;
InstallTemp(); InstallTemp();
chdir "$topdir/src/interfaces/ecpg/test"; chdir "$topdir/src/interfaces/ecpg/test";
$schedule = "ecpg"; my $schedule = "ecpg";
my @args = ( my @args = (
"../../../../$Config/pg_regress_ecpg/pg_regress_ecpg", "../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
"--bindir=", "--bindir=",
...@@ -219,6 +215,17 @@ sub bincheck ...@@ -219,6 +215,17 @@ sub bincheck
exit $mstat if $mstat; exit $mstat if $mstat;
} }
sub taptest
{
my $dir = shift;
die "no tests found!" unless -d "$topdir/$dir/t";
InstallTemp();
my $status = tap_check("$topdir/$dir");
exit $status if $status;
}
sub plcheck sub plcheck
{ {
chdir "../../pl"; chdir "../../pl";
...@@ -516,7 +523,6 @@ sub fetchRegressOpts ...@@ -516,7 +523,6 @@ sub fetchRegressOpts
$m =~ s{\\\r?\n}{}g; $m =~ s{\\\r?\n}{}g;
if ($m =~ /^\s*REGRESS_OPTS\s*\+?=(.*)/m) if ($m =~ /^\s*REGRESS_OPTS\s*\+?=(.*)/m)
{ {
# Substitute known Makefile variables, then ignore options that retain # Substitute known Makefile variables, then ignore options that retain
# an unhandled variable reference. Ignore anything that isn't an # an unhandled variable reference. Ignore anything that isn't an
# option starting with "--". # option starting with "--".
...@@ -587,16 +593,19 @@ sub GetTests ...@@ -587,16 +593,19 @@ sub GetTests
} }
sub InstallTemp sub InstallTemp
{
unless ($ENV{NO_TEMP_INSTALL})
{ {
print "Setting up temp install\n\n"; print "Setting up temp install\n\n";
Install("$tmp_installdir", "all", $config); Install("$tmp_installdir", "all", $config);
}
$ENV{PATH} = "$tmp_installdir/bin;$ENV{PATH}"; $ENV{PATH} = "$tmp_installdir/bin;$ENV{PATH}";
} }
sub usage sub usage
{ {
print STDERR print STDERR
"Usage: vcregress.pl <mode> [ <schedule> ]\n\n", "Usage: vcregress.pl <mode> [ <arg>]\n\n",
"Options for <mode>:\n", "Options for <mode>:\n",
" bincheck run tests of utilities in src/bin/\n", " bincheck run tests of utilities in src/bin/\n",
" check deploy instance and run regression tests on it\n", " check deploy instance and run regression tests on it\n",
...@@ -607,9 +616,12 @@ sub usage ...@@ -607,9 +616,12 @@ sub usage
" modulescheck run tests of modules in src/test/modules/\n", " modulescheck run tests of modules in src/test/modules/\n",
" plcheck run tests of PL languages\n", " plcheck run tests of PL languages\n",
" recoverycheck run recovery test suite\n", " recoverycheck run recovery test suite\n",
" taptest run an arbitrary TAP test set\n",
" upgradecheck run tests of pg_upgrade\n", " upgradecheck run tests of pg_upgrade\n",
"\nOptions for <schedule>:\n", "\nOptions for <arg>: (used by check and installcheck)\n",
" serial serial mode\n", " serial serial mode\n",
" parallel parallel mode\n"; " parallel parallel mode\n",
"\nOption for <arg>: for taptest\n",
" TEST_DIR (required) directory where tests reside\n";
exit(1); exit(1);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment