From a38f174f18dcb3f551c1194546f323f45068e8d1 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforwork@gmail.com>
Date: Tue, 5 Oct 2021 22:49:27 +0530
Subject: [PATCH v1] add subscriptioncheck option for vcregress for msvc builds

---
 doc/src/sgml/install-windows.sgml |  4 +++-
 src/tools/msvc/vcregress.pl       | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml
index ba794b8c93..b662a91694 100644
--- a/doc/src/sgml/install-windows.sgml
+++ b/doc/src/sgml/install-windows.sgml
@@ -461,6 +461,7 @@ $ENV{CONFIG}="Debug";
 <userinput>vcregress bincheck</userinput>
 <userinput>vcregress recoverycheck</userinput>
 <userinput>vcregress upgradecheck</userinput>
+<userinput>vcregress subscriptioncheck</userinput>
 </screen>
 
    To change the schedule used (default is parallel), append it to the
@@ -476,7 +477,8 @@ $ENV{CONFIG}="Debug";
   <para>
    Running the regression tests on client programs, with
    <command>vcregress bincheck</command>, or on recovery tests, with
-   <command>vcregress recoverycheck</command>, requires an additional Perl module
+   <command>vcregress recoverycheck</command>, or on subscription tests, with
+   <command>vcregress subscriptioncheck</command>, requires an additional Perl module
    to be installed:
    <variablelist>
     <varlistentry>
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 35e8f67f01..a787585a95 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -41,7 +41,7 @@ if (-e "src/tools/msvc/buildenv.pl")
 
 my $what = shift || "";
 if ($what =~
-	/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
+	/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|subscriptioncheck|taptest)$/i
   )
 {
 	$what = uc $what;
@@ -90,6 +90,7 @@ my %command = (
 	ISOLATIONCHECK => \&isolationcheck,
 	BINCHECK       => \&bincheck,
 	RECOVERYCHECK  => \&recoverycheck,
+	SUBSCRIPTIONCHECK  => \&subscriptioncheck,
 	UPGRADECHECK   => \&upgradecheck,
 	TAPTEST        => \&taptest,);
 
@@ -526,6 +527,17 @@ sub recoverycheck
 	return;
 }
 
+sub subscriptioncheck
+{
+	InstallTemp();
+
+	my $mstat  = 0;
+	my $dir    = "$topdir/src/test/subscription";
+	my $status = tap_check($dir);
+	exit $status if $status;
+	return;
+}
+
 # Run "initdb", then reconfigure authentication.
 sub standard_initdb
 {
@@ -778,6 +790,7 @@ sub usage
 	  "  modulescheck   run tests of modules in src/test/modules/\n",
 	  "  plcheck        run tests of PL languages\n",
 	  "  recoverycheck  run recovery test suite\n",
+	  "  subscriptioncheck  run subscription test suite\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",
-- 
2.33.0.windows.2

