[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0rc1-106-g5cefc43
git at osgeo.org
git at osgeo.org
Tue Mar 2 08:10:40 PST 2021
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, master has been updated
via 5cefc43ae4a7af6def49cbba0fd8f5f8eb556585 (commit)
from 24c1edea5e8f56c415338afec6139f7f5bd6c121 (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 5cefc43ae4a7af6def49cbba0fd8f5f8eb556585
Author: Sandro Santilli <strk at kbt.io>
Date: Tue Mar 2 17:08:58 2021 +0100
Add run_test.pl hook switches
Adds the following switches to run_test.pl:
--after-create-script <path>
--before-uninstall-script <path>
--before-upgrade-script <path>
--after-upgrade-script <path>
diff --git a/regress/run_test.pl b/regress/run_test.pl
index d018ecd..aae3d0e 100755
--- a/regress/run_test.pl
+++ b/regress/run_test.pl
@@ -66,6 +66,10 @@ my $OPT_WITH_RASTER = 0;
my $OPT_WITH_SFCGAL = 0;
my $OPT_EXPECT = 0;
my $OPT_EXTENSIONS = 0;
+my $OPT_HOOK_AFTER_CREATE = '';
+my $OPT_HOOK_BEFORE_UNINSTALL = '';
+my $OPT_HOOK_BEFORE_UPGRADE = '';
+my $OPT_HOOK_AFTER_UPGRADE = '';
my $OPT_EXTVERSION = '';
my $OPT_UPGRADE_PATH = '';
our $OPT_UPGRADE_FROM = '';
@@ -86,7 +90,11 @@ GetOptions (
'sfcgal' => \$OPT_WITH_SFCGAL,
'expect' => \$OPT_EXPECT,
'extensions' => \$OPT_EXTENSIONS,
- 'schema=s' => \$OPT_SCHEMA
+ 'schema=s' => \$OPT_SCHEMA,
+ 'after-create-script=s' => \$OPT_HOOK_AFTER_CREATE,
+ 'before-uninstall-script=s' => \$OPT_HOOK_BEFORE_UNINSTALL,
+ 'before-upgrade-script=s' => \$OPT_HOOK_BEFORE_UPGRADE,
+ 'after-upgrade-script=s' => \$OPT_HOOK_BEFORE_UPGRADE
);
if ( @ARGV < 1 )
@@ -291,7 +299,8 @@ sub semver_lessthan
sub create_upgrade_test_objects
{
- # TODO: allow passing the "upgrade-init" script via commandline
+
+ # TODO: replace the following with --before-upgrade-script usage
my $query = "create table upgrade_test(g1 geometry, g2 geography";
$query .= ", r raster" if ( $OPT_WITH_RASTER );
@@ -398,7 +407,13 @@ sub drop_upgrade_test_objects
if ( $OPT_UPGRADE )
{
- print " Upgrading from postgis $libver\n";
+ print "Upgrading from postgis $libver\n";
+
+ if ( '' ne $OPT_HOOK_BEFORE_UPGRADE )
+ {
+ print "Running before-upgrade-script $OPT_HOOK_BEFORE_UPGRADE\n";
+ die unless load_sql_file($OPT_HOOK_BEFORE_UPGRADE, 1);
+ }
create_upgrade_test_objects();
@@ -413,6 +428,12 @@ if ( $OPT_UPGRADE )
drop_upgrade_test_objects();
+ if ( '' ne $OPT_HOOK_AFTER_UPGRADE )
+ {
+ print " Running after-upgrade-script $OPT_HOOK_AFTER_UPGRADE\n";
+ die unless load_sql_file($OPT_HOOK_AFTER_UPGRADE, 1);
+ }
+
# Update libver
$libver = sql("select postgis_lib_version()");
}
@@ -465,6 +486,14 @@ our $TEST = "";
print "\nRunning tests\n\n";
+if ( '' ne $OPT_HOOK_AFTER_CREATE )
+{
+ start_test("after-create-script");
+ show_progress();
+ pass("($OPT_HOOK_AFTER_CREATE)")
+ if load_sql_file($OPT_HOOK_AFTER_CREATE, 1);
+}
+
foreach $TEST (@ARGV)
{
my $TEST_OBJ_COUNT_PRE;
@@ -545,6 +574,14 @@ foreach $TEST (@ARGV)
}
+if ( '' ne $OPT_HOOK_BEFORE_UNINSTALL )
+{
+ start_test("before-uninstall-script");
+ show_progress();
+ pass("($OPT_HOOK_BEFORE_UNINSTALL)")
+ if load_sql_file($OPT_HOOK_BEFORE_UNINSTALL, 1);
+}
+
###################################################################
# Uninstall postgis (serves as an uninstall test)
@@ -619,6 +656,14 @@ Options:
--clean cleanup test logs on exit
--expect save obtained output as expected
--extension load using extensions
+ --after-create-script <path>
+ script to load after spatial db creation
+ --before-uninstall-script <path>
+ script to load before spatial extension uninstall
+ --before-upgrade-script <path>
+ script to load before upgrade
+ --after-upgrade-script <path>
+ script to load after upgrade
};
}
@@ -1363,7 +1408,8 @@ sub load_sql_file
if ( $strict && ! -e $file )
{
- die "Unable to find $file\n";
+ fail "Unable to find $file";
+ return 0;
}
if ( -e $file )
@@ -1378,7 +1424,8 @@ sub load_sql_file
if ( $rv )
{
fail "Error encountered loading $file", $REGRESS_LOG;
- exit 1;
+ #exit 1;
+ return 0;
}
}
return 1;
@@ -1850,6 +1897,7 @@ sub drop_spatial_extensions
sub uninstall_spatial
{
my $ok;
+
start_test("uninstall");
if ( $OPT_EXTENSIONS )
@@ -1861,24 +1909,19 @@ sub uninstall_spatial
$ok = drop_spatial();
}
- if ( $ok )
- {
- show_progress(); # on to objects count
- $OBJ_COUNT_POST = count_db_objects();
+ return $ok if ! $ok;
- if ( $OBJ_COUNT_POST != $OBJ_COUNT_PRE )
- {
- fail("Object count pre-install ($OBJ_COUNT_PRE) != post-uninstall ($OBJ_COUNT_POST)");
- return 0;
- }
- else
- {
- pass("($OBJ_COUNT_PRE)");
- return 1;
- }
+ show_progress(); # on to objects count
+ $OBJ_COUNT_POST = count_db_objects();
+
+ if ( $OBJ_COUNT_POST != $OBJ_COUNT_PRE )
+ {
+ fail("Object count pre-install ($OBJ_COUNT_PRE) != post-uninstall ($OBJ_COUNT_POST)");
+ return 0;
}
- return 0;
+ pass("($OBJ_COUNT_PRE)");
+ return 1;
}
# Dump and restore the database
-----------------------------------------------------------------------
Summary of changes:
regress/run_test.pl | 83 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 63 insertions(+), 20 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list