]> granicus.if.org Git - postgresql/commitdiff
Allow vcregress.pl to run an arbitrary TAP test set
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 1 May 2017 14:12:02 +0000 (10:12 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 1 May 2017 14:51:12 +0000 (10:51 -0400)
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.

src/tools/msvc/vcregress.pl

index fdddae3ec4aff5b52cc165f1e504c724477f2b05..c23cbdb96834711bd03e19a34b6999939024f58c 100644 (file)
@@ -34,7 +34,7 @@ if (-e "src/tools/msvc/buildenv.pl")
 
 my $what = shift || "";
 if ($what =~
-/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck|upgradecheck|bincheck)$/i
+/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|taptest)$/i
   )
 {
        $what = uc $what;
@@ -54,13 +54,6 @@ copy("$Config/dummy_seclabel/dummy_seclabel.dll", "src/test/regress");
 
 $ENV{PATH} = "../../../$Config/libpq;../../$Config/libpq;$ENV{PATH}";
 
-my $schedule = shift;
-unless ($schedule)
-{
-       $schedule = "serial";
-       $schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
-}
-
 if ($ENV{PERL5LIB})
 {
        $ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
@@ -88,13 +81,14 @@ my %command = (
        CONTRIBCHECK   => \&contribcheck,
        ISOLATIONCHECK => \&isolationcheck,
        BINCHECK       => \&bincheck,
-       UPGRADECHECK   => \&upgradecheck,);
+       UPGRADECHECK   => \&upgradecheck,
+       TAPTEST        => \&taptest,);
 
 my $proc = $command{$what};
 
 exit 3 unless $proc;
 
-&$proc();
+&$proc(@_);
 
 exit 0;
 
@@ -102,6 +96,7 @@ exit 0;
 
 sub installcheck
 {
+       my $schedule = shift || 'serial';
        my @args = (
                "../../../$Config/pg_regress/pg_regress",
                "--dlpath=.",
@@ -117,6 +112,7 @@ sub installcheck
 
 sub check
 {
+       my $schedule = shift || 'parallel';
        my @args = (
                "../../../$Config/pg_regress/pg_regress",
                "--dlpath=.",
@@ -140,8 +136,8 @@ sub ecpgcheck
        my $status = $? >> 8;
        exit $status if $status;
        chdir "$topdir/src/interfaces/ecpg/test";
-       $schedule = "ecpg";
-       my @args = (
+       my $schedule = "ecpg";
+       my @args     = (
                "../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
                "--psqldir=../../../$Config/psql",
                "--dbname=regress1,connectdb",
@@ -215,6 +211,17 @@ sub bincheck
        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
 {
        chdir "../../pl";
@@ -442,7 +449,6 @@ sub fetchRegressOpts
        $m =~ s{\\\r?\n}{}g;
        if ($m =~ /^\s*REGRESS_OPTS\s*=(.*)/m)
        {
-
                # Substitute known Makefile variables, then ignore options that retain
                # an unhandled variable reference.  Ignore anything that isn't an
                # option starting with "--".
@@ -515,14 +521,32 @@ sub GetTests
 
 sub InstallTemp
 {
-   print "Setting up temp install\n\n";
-   Install("$tmp_installdir", "all", $config);
+       unless ($ENV{NO_TEMP_INSTALL})
+       {
+               print "Setting up temp install\n\n";
+               Install("$tmp_installdir", "all", $config);
+       }
+       $ENV{PATH} = "$tmp_installdir/bin;$ENV{PATH}";
 }
 
 sub usage
 {
        print STDERR
-         "Usage: vcregress.pl ",
-         "<check|installcheck|plcheck|contribcheck|isolationcheck|ecpgcheck|upgradecheck> [schedule]\n";
+         "Usage: vcregress.pl <mode> [ <arg>]\n\n",
+         "Options for <mode>:\n",
+         "  bincheck       run tests of utilities in src/bin/\n",
+         "  check          deploy instance and run regression tests on it\n",
+         "  contribcheck   run tests of modules in contrib/\n",
+         "  ecpgcheck      run regression tests of ECPG\n",
+         "  installcheck   run regression tests on existing instance\n",
+         "  isolationcheck run isolation tests\n",
+         "  plcheck        run tests of PL languages\n",
+         "  taptest        run an arbitrary TAP test set\n",
+         "  upgradecheck   run tests of pg_upgrade\n",
+         "\nOptions for <arg>: (used by check and installcheck)\n",
+         "  serial         serial mode\n",
+         "  parallel       parallel mode\n",
+         "\nOption for <arg>: for taptest\n",
+         "  TEST_DIR       (required) directory where tests reside\n";
        exit(1);
 }