Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d835dd6

Browse files
committed
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.
1 parent 7907a94 commit d835dd6

File tree

1 file changed

+35
-26
lines changed

1 file changed

+35
-26
lines changed

src/tools/msvc/vcregress.pl

+35-26
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
my $what = shift || "";
3636
if ($what =~
37-
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|tapcheck)$/i
37+
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck)$/i
3838
)
3939
{
4040
$what = uc $what;
@@ -61,7 +61,14 @@
6161
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
6262
}
6363

64-
$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
64+
if ($ENV{PERL5LIB})
65+
{
66+
$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
67+
}
68+
else
69+
{
70+
$ENV{PERL5LIB} = "$topdir/src/tools/msvc";
71+
}
6572

6673
my $maxconn = "";
6774
$maxconn = "--max_connections=$ENV{MAX_CONNECTIONS}"
@@ -81,7 +88,7 @@
8188
CONTRIBCHECK => \&contribcheck,
8289
MODULESCHECK => \&modulescheck,
8390
ISOLATIONCHECK => \&isolationcheck,
84-
TAPCHECK => \&tapcheck,
91+
BINCHECK => \&bincheck,
8592
UPGRADECHECK => \&upgradecheck,);
8693

8794
my $proc = $command{$what};
@@ -168,41 +175,43 @@ sub isolationcheck
168175
exit $status if $status;
169176
}
170177

171-
sub tapcheck
178+
sub tap_check
172179
{
173-
InstallTemp();
180+
die "Tap tests not enabled in configuration"
181+
unless $config->{tap_tests};
182+
183+
my $dir = shift;
184+
chdir $dir;
174185

175186
my @args = ( "prove", "--verbose", "t/*.pl");
176-
my $mstat = 0;
177187

188+
# adjust the environment for just this test
189+
local %ENV = %ENV;
178190
$ENV{PERL5LIB} = "$topdir/src/test/perl;$ENV{PERL5LIB}";
179191
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
180192

193+
$ENV{TESTDIR} = "$dir";
194+
195+
system(@args);
196+
my $status = $? >> 8;
197+
return $status;
198+
}
199+
200+
sub bincheck
201+
{
202+
InstallTemp();
203+
204+
my $mstat = 0;
205+
181206
# Find out all the existing TAP tests by looking for t/ directories
182207
# in the tree.
183-
my $tap_dirs = [];
184-
my @top_dir = ($topdir);
185-
File::Find::find(
186-
{ wanted => sub {
187-
/^t\z/s
188-
&& push(@$tap_dirs, $File::Find::name);
189-
}
190-
},
191-
@top_dir);
208+
my @bin_dirs = glob("$topdir/src/bin/*");
192209

193210
# Process each test
194-
foreach my $test_path (@$tap_dirs)
211+
foreach my $dir (@$bin_dirs)
195212
{
196-
# Like on Unix "make check-world", don't run the SSL test suite
197-
# automatically.
198-
next if ($test_path =~ /\/src\/test\/ssl\//);
199-
200-
my $dir = dirname($test_path);
201-
chdir $dir;
202-
# Reset those values, they may have been changed by another test.
203-
$ENV{TESTDIR} = "$dir";
204-
system(@args);
205-
my $status = $? >> 8;
213+
next unless -d "$dir/t";
214+
my $status = tap_check($dir);
206215
$mstat ||= $status;
207216
}
208217
exit $mstat if $mstat;

0 commit comments

Comments
 (0)