enabling FOO=bar arguments to vcregress.pl
As I mentioned recently at
</messages/by-id/5d72f199-dc11-89a8-29d1-f20f9687c86f@dunslane.net>,%C2%A0
I want to get USE_MODULE_DB working for vcregress.pl. I started out
writing code to strip this from the command line or get it from the
environment, but then it struck me that if would be better to implement
a general Makefile-like mechanism for handling FOO=bar type arguments on
the command line, along the lines of the attached.
Thoughts?
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
Attachments:
vcregress-foo=bar.patchtext/x-patch; charset=UTF-8; name="vcregress-foo=bar.patch"Download
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index fc826da3ff..168ea7f82a 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -39,6 +39,14 @@ if (-e "src/tools/msvc/buildenv.pl")
do "./src/tools/msvc/buildenv.pl";
}
+my %settings;
+
+while (@ARGV && $ARGV[0] =~ /([A-Za-z]\w*)=(.*)/)
+{
+ $settings{$1}={$2};
+ shift;
+}
+
my $what = shift || "";
if ($what =~
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
On Mon, Nov 01, 2021 at 11:33:21AM -0400, Andrew Dunstan wrote:
As I mentioned recently at
</messages/by-id/5d72f199-dc11-89a8-29d1-f20f9687c86f@dunslane.net>,%C2%A0
I want to get USE_MODULE_DB working for vcregress.pl. I started out
writing code to strip this from the command line or get it from the
environment, but then it struck me that if would be better to implement
a general Makefile-like mechanism for handling FOO=bar type arguments on
the command line, along the lines of the attached.
I am not sure to understand how that will that work with USE_MODULE_DB
which sets up the database names used by the regression tests. Each
target's module has its own needs in terms of settings that can be
used, meaning that you would still need some boilerplate to do the
mapping between a variable and its command argument?
--
Michael
On 11/1/21 21:23, Michael Paquier wrote:
On Mon, Nov 01, 2021 at 11:33:21AM -0400, Andrew Dunstan wrote:
As I mentioned recently at
</messages/by-id/5d72f199-dc11-89a8-29d1-f20f9687c86f@dunslane.net>,%C2%A0
I want to get USE_MODULE_DB working for vcregress.pl. I started out
writing code to strip this from the command line or get it from the
environment, but then it struck me that if would be better to implement
a general Makefile-like mechanism for handling FOO=bar type arguments on
the command line, along the lines of the attached.I am not sure to understand how that will that work with USE_MODULE_DB
which sets up the database names used by the regression tests. Each
target's module has its own needs in terms of settings that can be
used, meaning that you would still need some boilerplate to do the
mapping between a variable and its command argument?
I think you misunderstood the purpose of my email. It wasn't meant to
be complete patch.
But here's an untested patch that should do almost all of what I want
for USE_MODULE_DB.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
Attachments:
msvc-use-module-db.patchtext/x-patch; charset=UTF-8; name=msvc-use-module-db.patchDownload
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index fc826da3ff..840931b210 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -39,6 +39,14 @@ if (-e "src/tools/msvc/buildenv.pl")
do "./src/tools/msvc/buildenv.pl";
}
+my %settings;
+
+while (@ARGV && $ARGV[0] =~ /([A-Za-z]\w*)=(.*)/)
+{
+ $settings{$1}={$2};
+ shift;
+}
+
my $what = shift || "";
if ($what =~
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
@@ -411,10 +419,12 @@ sub plcheck
print
"============================================================\n";
print "Checking $lang\n";
+ my $dbname = "pl_regression";
+ $dbname = "pl_regression_$lang" if $settings{USE_MODULE_DB};
my @args = (
"$topdir/$Config/pg_regress/pg_regress",
"--bindir=$topdir/$Config/psql",
- "--dbname=pl_regression", @lang_args, @tests);
+ "--dbname=$dbname", @lang_args, @tests);
system(@args);
my $status = $? >> 8;
exit $status if $status;
@@ -692,6 +702,12 @@ sub fetchRegressOpts
{
push @opts, "--no-locale";
}
+ if ($settings{USE_MODULE_DB} && $m =~ /^\s*MODULE(?:S|_big)\s*=\s*(\S+)/m)
+ {
+ my $dbname = $1;
+ $dbname =~ s/plpython.*/plpython/;
+ push @opts, "--dbname=contrib_regression_$dbname";
+ }
return @opts;
}
On 11/2/21 11:03, Andrew Dunstan wrote:
On 11/1/21 21:23, Michael Paquier wrote:
On Mon, Nov 01, 2021 at 11:33:21AM -0400, Andrew Dunstan wrote:
As I mentioned recently at
</messages/by-id/5d72f199-dc11-89a8-29d1-f20f9687c86f@dunslane.net>,%C2%A0
I want to get USE_MODULE_DB working for vcregress.pl. I started out
writing code to strip this from the command line or get it from the
environment, but then it struck me that if would be better to implement
a general Makefile-like mechanism for handling FOO=bar type arguments on
the command line, along the lines of the attached.I am not sure to understand how that will that work with USE_MODULE_DB
which sets up the database names used by the regression tests. Each
target's module has its own needs in terms of settings that can be
used, meaning that you would still need some boilerplate to do the
mapping between a variable and its command argument?I think you misunderstood the purpose of my email. It wasn't meant to
be complete patch.But here's an untested patch that should do almost all of what I want
for USE_MODULE_DB.
Now tested and doing what is expected. I'd like to backpatch it. Nobody
who doesn't set USE_MODULE_DB would be at all affected, but I want to
enable it for MSVC builds in the buildfarm.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
On Tue, Nov 02, 2021 at 05:59:49PM -0400, Andrew Dunstan wrote:
On 11/2/21 11:03, Andrew Dunstan wrote:
I think you misunderstood the purpose of my email. It wasn't meant to
be complete patch.But here's an untested patch that should do almost all of what I want
for USE_MODULE_DB.Now tested and doing what is expected. I'd like to backpatch it. Nobody
who doesn't set USE_MODULE_DB would be at all affected, but I want to
enable it for MSVC builds in the buildfarm.
Okay, now I get your intention here, thanks. Shouldn't you add some
documentation to show out to use this facility when passing down
parameters?
--
Michael