Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fed6df4

Browse files
committed
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.
1 parent 9414e41 commit fed6df4

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

src/tools/msvc/vcregress.pl

Lines changed: 31 additions & 19 deletions
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|bincheck|recoverycheck)$/i
37+
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
3838
)
3939
{
4040
$what = uc $what;
@@ -54,13 +54,6 @@
5454

5555
$ENV{PATH} = "$topdir/$Config/libpq;$ENV{PATH}";
5656

57-
my $schedule = shift;
58-
unless ($schedule)
59-
{
60-
$schedule = "serial";
61-
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
62-
}
63-
6457
if ($ENV{PERL5LIB})
6558
{
6659
$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
@@ -90,20 +83,22 @@
9083
ISOLATIONCHECK => \&isolationcheck,
9184
BINCHECK => \&bincheck,
9285
RECOVERYCHECK => \&recoverycheck,
93-
UPGRADECHECK => \&upgradecheck,);
86+
UPGRADECHECK => \&upgradecheck,
87+
TAPTEST => \&taptest,);
9488

9589
my $proc = $command{$what};
9690

9791
exit 3 unless $proc;
9892

99-
&$proc();
93+
&$proc(@_);
10094

10195
exit 0;
10296

10397
########################################################################
10498

10599
sub installcheck
106100
{
101+
my $schedule = shift || 'serial';
107102
my @args = (
108103
"../../../$Config/pg_regress/pg_regress",
109104
"--dlpath=.",
@@ -119,6 +114,7 @@ sub installcheck
119114

120115
sub check
121116
{
117+
my $schedule = shift || 'parallel';
122118
InstallTemp();
123119
chdir "${topdir}/src/test/regress";
124120
my @args = (
@@ -138,15 +134,15 @@ sub check
138134

139135
sub ecpgcheck
140136
{
141-
my $msbflags = $ENV{MSBFLAGS} || "";
137+
my $msbflags = $ENV{MSBFLAGS} || "";
142138
chdir $startdir;
143139
system("msbuild ecpg_regression.proj $msbflags /p:config=$Config");
144140
my $status = $? >> 8;
145141
exit $status if $status;
146142
InstallTemp();
147143
chdir "$topdir/src/interfaces/ecpg/test";
148-
$schedule = "ecpg";
149-
my @args = (
144+
my $schedule = "ecpg";
145+
my @args = (
150146
"../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
151147
"--bindir=",
152148
"--dbname=ecpg1_regression,ecpg2_regression",
@@ -219,6 +215,17 @@ sub bincheck
219215
exit $mstat if $mstat;
220216
}
221217

218+
sub taptest
219+
{
220+
my $dir = shift;
221+
222+
die "no tests found!" unless -d "$topdir/$dir/t";
223+
224+
InstallTemp();
225+
my $status = tap_check("$topdir/$dir");
226+
exit $status if $status;
227+
}
228+
222229
sub plcheck
223230
{
224231
chdir "../../pl";
@@ -516,7 +523,6 @@ sub fetchRegressOpts
516523
$m =~ s{\\\r?\n}{}g;
517524
if ($m =~ /^\s*REGRESS_OPTS\s*\+?=(.*)/m)
518525
{
519-
520526
# Substitute known Makefile variables, then ignore options that retain
521527
# an unhandled variable reference. Ignore anything that isn't an
522528
# option starting with "--".
@@ -588,15 +594,18 @@ sub GetTests
588594

589595
sub InstallTemp
590596
{
591-
print "Setting up temp install\n\n";
592-
Install("$tmp_installdir", "all", $config);
597+
unless ($ENV{NO_TEMP_INSTALL})
598+
{
599+
print "Setting up temp install\n\n";
600+
Install("$tmp_installdir", "all", $config);
601+
}
593602
$ENV{PATH} = "$tmp_installdir/bin;$ENV{PATH}";
594603
}
595604

596605
sub usage
597606
{
598607
print STDERR
599-
"Usage: vcregress.pl <mode> [ <schedule> ]\n\n",
608+
"Usage: vcregress.pl <mode> [ <arg>]\n\n",
600609
"Options for <mode>:\n",
601610
" bincheck run tests of utilities in src/bin/\n",
602611
" check deploy instance and run regression tests on it\n",
@@ -607,9 +616,12 @@ sub usage
607616
" modulescheck run tests of modules in src/test/modules/\n",
608617
" plcheck run tests of PL languages\n",
609618
" recoverycheck run recovery test suite\n",
619+
" taptest run an arbitrary TAP test set\n",
610620
" upgradecheck run tests of pg_upgrade\n",
611-
"\nOptions for <schedule>:\n",
621+
"\nOptions for <arg>: (used by check and installcheck)\n",
612622
" serial serial mode\n",
613-
" parallel parallel mode\n";
623+
" parallel parallel mode\n",
624+
"\nOption for <arg>: for taptest\n",
625+
" TEST_DIR (required) directory where tests reside\n";
614626
exit(1);
615627
}

0 commit comments

Comments
 (0)