Add an option to allow run regression test for individual module on Windows build

Started by David Zhangover 5 years ago1 messages
#1David Zhang
david.zhang@highgo.ca
1 attachment(s)

Hi Hackers,

When I was working on an extension on Windows platform, I used the
command 'vcregress contribcheck' to run the regression test for my
module. However, this command will run the regression test for all the
modules, I couldn't find a way to regress test my module only. I think
it would be better to have such an option to make the development be
more efficient (Maybe there is a solution already, but I can't find it).

The attached patch allow user to run the regression test by using either
'vcregress contribcheck' or 'vcregress contribcheck postgres_fdw' if you
want to test your extension directly, for example, 'postgres_fdw'.

--
David

Software Engineer
Highgo Software Inc. (Canada)
www.highgo.ca

Attachments:

regression-test-individual-module-on-windows-build.patchtext/plain; charset=UTF-8; name=regression-test-individual-module-on-windows-build.patch; x-mac-creator=0; x-mac-type=0Download
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index dac60f6264..9db740a847 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -448,23 +448,40 @@ sub subdircheck
 	return;
 }
 
+sub contribmodulecheck
+{
+	my $module = shift;
+	my $mstat = shift;
+
+	# these configuration-based exclusions must match Install.pm
+	next if ($module eq "uuid-ossp"  && !defined($config->{uuid}));
+	next if ($module eq "sslinfo"    && !defined($config->{openssl}));
+	next if ($module eq "xml2"       && !defined($config->{xml}));
+	next if ($module =~ /_plperl$/   && !defined($config->{perl}));
+	next if ($module =~ /_plpython$/ && !defined($config->{python}));
+	next if ($module eq "sepgsql");
+
+	subdircheck($module);
+	my $status = $? >> 8;
+	$$mstat ||= $status;
+}
+
 sub contribcheck
 {
 	chdir "../../../contrib";
 	my $mstat = 0;
-	foreach my $module (glob("*"))
-	{
-		# these configuration-based exclusions must match Install.pm
-		next if ($module eq "uuid-ossp"  && !defined($config->{uuid}));
-		next if ($module eq "sslinfo"    && !defined($config->{openssl}));
-		next if ($module eq "xml2"       && !defined($config->{xml}));
-		next if ($module =~ /_plperl$/   && !defined($config->{perl}));
-		next if ($module =~ /_plpython$/ && !defined($config->{python}));
-		next if ($module eq "sepgsql");
 
-		subdircheck($module);
-		my $status = $? >> 8;
-		$mstat ||= $status;
+	my $module = shift;
+	if ($module ne "" )
+	{
+		contribmodulecheck($module, \$mstat);
+	}
+	else
+	{
+		foreach my $module (glob("*"))
+		{
+			contribmodulecheck($module, \$mstat);
+		}
 	}
 	exit $mstat if $mstat;
 	return;
@@ -760,6 +777,8 @@ sub usage
 	  "  serial         serial mode\n",
 	  "  parallel       parallel mode\n",
 	  "\nOption for <arg>: for taptest\n",
-	  "  TEST_DIR       (required) directory where tests reside\n";
+	  "  TEST_DIR       (required) directory where tests reside\n",
+	  "\nOption for <arg>: for contribcheck\n",
+	  "  module       (optional) module name to be tested only\n";
 	exit(1);
 }