aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2015-11-18 22:47:41 -0500
committerAndrew Dunstan <andrew@dunslane.net>2015-11-18 23:37:56 -0500
commitb06a8e3cc24d29d5c6eee0220a32c3155726daf9 (patch)
tree2b97ce0285d403decfd3539fe1a714504b8a8057
parentd5bb7c6f699cf4ce9250fcd14e0ec129c0f1a507 (diff)
downloadpostgresql-b06a8e3cc24d29d5c6eee0220a32c3155726daf9.tar.gz
postgresql-b06a8e3cc24d29d5c6eee0220a32c3155726daf9.zip
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.
-rw-r--r--src/tools/msvc/vcregress.pl61
1 files changed, 36 insertions, 25 deletions
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 84114205bb5..1723a5644ec 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -33,7 +33,7 @@ if (-e "src/tools/msvc/buildenv.pl")
my $what = shift || "";
if ($what =~
-/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck|upgradecheck|tapcheck)$/i
+/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck|upgradecheck|bincheck)$/i
)
{
$what = uc $what;
@@ -60,7 +60,14 @@ unless ($schedule)
$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 = "";
$maxconn = "--max_connections=$ENV{MAX_CONNECTIONS}"
@@ -79,7 +86,7 @@ my %command = (
ECPGCHECK => \&ecpgcheck,
CONTRIBCHECK => \&contribcheck,
ISOLATIONCHECK => \&isolationcheck,
- TAPCHECK => \&tapcheck,
+ BINCHECK => \&bincheck,
UPGRADECHECK => \&upgradecheck,);
my $proc = $command{$what};
@@ -165,39 +172,43 @@ sub isolationcheck
exit $status if $status;
}
-sub tapcheck
+sub tap_check
{
+ die "Tap tests not enabled in configuration"
+ unless $config->{tap_tests};
+
+ my $dir = shift;
+ chdir $dir;
+
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{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
# in the tree.
- my $tap_dirs = [];
- my @top_dir = ($topdir);
- File::Find::find(
- { wanted => sub {
- /^t\z/s
- && push(@$tap_dirs, $File::Find::name);
- }
- },
- @top_dir);
+ my @bin_dirs = glob("$topdir/src/bin/*");
# Process each test
- foreach my $test_path (@$tap_dirs)
+ foreach my $dir (@$bin_dirs)
{
- my $dir = dirname($test_path);
- my $tmp_root = "$dir/tmp_check";
- (mkdir $tmp_root || die $!) unless -d $tmp_root;
- my $tmp_install = "$tmp_root/install";
- Install($tmp_install, "all", $config);
- chdir $dir;
- # Reset those values, they may have been changed by another test.
- $ENV{TESTDIR} = "$dir";
- system(@args);
- my $status = $? >> 8;
+ next unless -d "$dir/t";
+ my $status = tap_check($dir);
$mstat ||= $status;
}
exit $mstat if $mstat;