[SCM] PostGIS branch stable-3.4 updated. 3.4.1-17-g19fc08111
git at osgeo.org
git at osgeo.org
Wed Dec 27 01:42:43 PST 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, stable-3.4 has been updated
via 19fc081112317a44b27cde40616fa3f321326e28 (commit)
from 61b71ba09c98e9d9a3548035e7fcec93c2b0ebc1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 19fc081112317a44b27cde40616fa3f321326e28
Author: Sandro Santilli <strk at kbt.io>
Date: Wed Dec 27 10:38:30 2023 +0100
Update run_test.pl to version from master
Adds:
- POSTGIS_REGRESS_DB_OWNER env variable
- POSTGIS_REGRESS_ROLE_EXT_CREATOR env variable
- Commandline switch --after-create-db-script
diff --git a/regress/run_test.pl b/regress/run_test.pl
index 96028bf4f..7c297ba6d 100755
--- a/regress/run_test.pl
+++ b/regress/run_test.pl
@@ -49,6 +49,9 @@ BEGIN {
our $DB = $ENV{"POSTGIS_REGRESS_DB"} || "postgis_reg";
our $REGDIR = $ENV{"POSTGIS_REGRESS_DIR"} || abs_path(dirname($0));
+our $DB_OWNER = $ENV{"POSTGIS_REGRESS_DB_OWNER"};
+our $DB_ROLE_EXT_MKR = $ENV{"POSTGIS_REGRESS_ROLE_EXT_CREATOR"} || $DB_OWNER;
+
our $TOP_SOURCEDIR = ${REGDIR} . '/..';
our $ABS_TOP_SOURCEDIR = abs_path(${TOP_SOURCEDIR});
our $TOP_BUILDDIR = $ENV{"POSTGIS_TOP_BUILD_DIR"};
@@ -80,6 +83,7 @@ my $OPT_EXPECT = 0;
my $OPT_EXTENSIONS = 0;
my $OPT_LEGACY = 0;
my @OPT_HOOK_AFTER_CREATE;
+my @OPT_HOOK_AFTER_CREATE_DB;
my @OPT_HOOK_AFTER_RESTORE;
my @OPT_HOOK_BEFORE_DUMP;
my @OPT_HOOK_BEFORE_TEST;
@@ -112,6 +116,7 @@ GetOptions (
'schema=s' => \$OPT_SCHEMA,
'build-dir=s' => \$TOP_BUILDDIR,
'after-create-script=s' => \@OPT_HOOK_AFTER_CREATE,
+ 'after-create-db-script=s' => \@OPT_HOOK_AFTER_CREATE_DB,
'after-test-script=s' => \@OPT_HOOK_AFTER_TEST,
'before-uninstall-script=s' => \@OPT_HOOK_BEFORE_UNINSTALL,
'before-test-script=s' => \@OPT_HOOK_BEFORE_TEST,
@@ -433,7 +438,7 @@ if ( $OPT_DUMPRESTORE )
print "Creating db '${DB}'\n";
$rv = create_db();
if ( ! $rv ) {
- fail("Could not create db ${DB}", $REGRESS_LOG);
+ fail("Could not create db ${DB} (create_db returned $rv)", $REGRESS_LOG);
die;
}
@@ -734,6 +739,9 @@ Options:
--after-create-script <path>
script to load after spatial db creation
(multiple switches supported, to be run in given order)
+ --after-create-db-script <path>
+ script to load after db creation
+ (multiple switches supported, to be run in given order)
--before-uninstall-script <path>
script to load before spatial extension uninstall
(multiple switches supported, to be run in given order)
@@ -755,6 +763,21 @@ Options:
--after-test-script <path>
script to load after each test run
(multiple switches supported, to be run in given order)
+Environment Variables:
+ POSTGIS_REGRESS_DB
+ Name of database to create and use for regression tests.
+ Defaults to "postgis_reg"
+ POSTGIS_REGRESS_DB_OWNER
+ PostgreSQL role to become owner of the regress db.
+ Defaults to connecting user (determined by libpq env
+ variables)
+ POSTGIS_REGRESS_ROLE_EXT_CREATOR
+ PostgreSQL role to switch to for creating/upgrading the
+ postgis extensions. Defaults to POSTGIS_REGRESS_DB_OWNER
+ POSTGIS_REGRESS_DIR
+ Base directory of regress tests. Defaults to
+ name of directory containing this script.
+
};
}
@@ -1490,16 +1513,28 @@ sub create_db
{
my $createcmd = "createdb --encoding=UTF-8 --template=template0 --lc-collate=C";
if ( $pgvernum ge 150000 ) {
- $createcmd .= " --locale=C --locale-provider=libc"
+ $createcmd .= " --locale=C --locale-provider=libc";
}
- $createcmd .= " $DB > $REGRESS_LOG";
- return not system($createcmd);
+ if ( $DB_OWNER ) {
+ $createcmd .= " --owner $DB_OWNER";
+ }
+ $createcmd .= " $DB > $REGRESS_LOG 2>&1";
+
+ return 0 if system($createcmd);
+
+ foreach my $hook (@OPT_HOOK_AFTER_CREATE_DB)
+ {
+ print "Running after-create-db-script $hook\n";
+ die unless load_sql_file($hook, 1);
+ }
+
+ return 1;
}
sub create_spatial
{
my ($cmd, $rv);
- print "Creating database '$DB' \n";
+ print "Creating database '$DB'.\n";
$rv = create_db();
@@ -1546,6 +1581,7 @@ sub load_sql_file
my $cmd = "psql $psql_opts -c 'CREATE SCHEMA IF NOT EXISTS $OPT_SCHEMA' ";
$cmd .= "-c 'SET search_path TO $OPT_SCHEMA,topology'";
$cmd .= " -v \"opt_dumprestore=${OPT_DUMPRESTORE}\"";
+ $cmd .= " -v \"regdir=$REGDIR\"";
$cmd .= " -Xf $file $DB >> $REGRESS_LOG 2>&1";
#print " $file\n" if $VERBOSE;
my $rv = system($cmd);
@@ -1571,6 +1607,11 @@ sub prepare_spatial_extensions
# ON_ERROR_STOP is used by psql to return non-0 on an error
my $psql_opts = "--no-psqlrc --variable ON_ERROR_STOP=true";
+ if ( $DB_ROLE_EXT_MKR ) {
+ print "Using role '$DB_ROLE_EXT_MKR' for spatial extensions creation.\n";
+ $psql_opts .= " -c \"set role='$DB_ROLE_EXT_MKR'\"";
+ }
+
my $sql = "CREATE SCHEMA IF NOT EXISTS ${OPT_SCHEMA}";
my $cmd = "psql $psql_opts -c \"". $sql . "\" $DB >> $REGRESS_LOG 2>&1";
my $rv = system($cmd);
@@ -1802,6 +1843,11 @@ sub upgrade_spatial_extensions
my $sql;
my $upgrade_via_function = 0;
+ if ( $DB_ROLE_EXT_MKR ) {
+ print "Using role '$DB_ROLE_EXT_MKR' for spatial extensions upgrade.\n";
+ $psql_opts .= " -c \"set role='$DB_ROLE_EXT_MKR'\"";
+ }
+
if ( $OPT_UPGRADE_TO =~ /!$/ )
{
$OPT_UPGRADE_TO =~ s/!$//;
-----------------------------------------------------------------------
Summary of changes:
regress/run_test.pl | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 51 insertions(+), 5 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list