Commit d835dd66 authored by Andrew Dunstan's avatar Andrew Dunstan

Improve vcregress.pl's handling of tap tests for client programs

The target is now named 'bincheck' rather than 'tapcheck' so that it
reflects what is checked instead of the test mechanism. Some of the
logic is improved, making it easier to add further sets of TAP based
tests in future. Also, the environment setting logic is imrpoved.

As discussed on -hackers a couple of months ago.
parent 7907a949
...@@ -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|tapcheck)$/i /^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck)$/i
) )
{ {
$what = uc $what; $what = uc $what;
...@@ -61,7 +61,14 @@ unless ($schedule) ...@@ -61,7 +61,14 @@ unless ($schedule)
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/); $schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
} }
$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}"; if ($ENV{PERL5LIB})
{
$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
}
else
{
$ENV{PERL5LIB} = "$topdir/src/tools/msvc";
}
my $maxconn = ""; my $maxconn = "";
$maxconn = "--max_connections=$ENV{MAX_CONNECTIONS}" $maxconn = "--max_connections=$ENV{MAX_CONNECTIONS}"
...@@ -81,7 +88,7 @@ my %command = ( ...@@ -81,7 +88,7 @@ my %command = (
CONTRIBCHECK => \&contribcheck, CONTRIBCHECK => \&contribcheck,
MODULESCHECK => \&modulescheck, MODULESCHECK => \&modulescheck,
ISOLATIONCHECK => \&isolationcheck, ISOLATIONCHECK => \&isolationcheck,
TAPCHECK => \&tapcheck, BINCHECK => \&bincheck,
UPGRADECHECK => \&upgradecheck,); UPGRADECHECK => \&upgradecheck,);
my $proc = $command{$what}; my $proc = $command{$what};
...@@ -168,41 +175,43 @@ sub isolationcheck ...@@ -168,41 +175,43 @@ sub isolationcheck
exit $status if $status; exit $status if $status;
} }
sub tapcheck sub tap_check
{ {
InstallTemp(); die "Tap tests not enabled in configuration"
unless $config->{tap_tests};
my $dir = shift;
chdir $dir;
my @args = ( "prove", "--verbose", "t/*.pl"); my @args = ( "prove", "--verbose", "t/*.pl");
my $mstat = 0;
# adjust the environment for just this test
local %ENV = %ENV;
$ENV{PERL5LIB} = "$topdir/src/test/perl;$ENV{PERL5LIB}"; $ENV{PERL5LIB} = "$topdir/src/test/perl;$ENV{PERL5LIB}";
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress"; $ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
$ENV{TESTDIR} = "$dir";
system(@args);
my $status = $? >> 8;
return $status;
}
sub bincheck
{
InstallTemp();
my $mstat = 0;
# Find out all the existing TAP tests by looking for t/ directories # Find out all the existing TAP tests by looking for t/ directories
# in the tree. # in the tree.
my $tap_dirs = []; my @bin_dirs = glob("$topdir/src/bin/*");
my @top_dir = ($topdir);
File::Find::find(
{ wanted => sub {
/^t\z/s
&& push(@$tap_dirs, $File::Find::name);
}
},
@top_dir);
# Process each test # Process each test
foreach my $test_path (@$tap_dirs) foreach my $dir (@$bin_dirs)
{ {
# Like on Unix "make check-world", don't run the SSL test suite next unless -d "$dir/t";
# automatically. my $status = tap_check($dir);
next if ($test_path =~ /\/src\/test\/ssl\//);
my $dir = dirname($test_path);
chdir $dir;
# Reset those values, they may have been changed by another test.
$ENV{TESTDIR} = "$dir";
system(@args);
my $status = $? >> 8;
$mstat ||= $status; $mstat ||= $status;
} }
exit $mstat if $mstat; exit $mstat if $mstat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment