[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0rc1-179-g155a4e6

git at osgeo.org git at osgeo.org
Wed May 5 12:07:17 PDT 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  155a4e664b51ed6742ca8adffbdc60f1059a9c30 (commit)
       via  30706a68a780d6a1555f950f7bae673e649d64ef (commit)
      from  87c0512dac0b6f1e06cb0a23d6e2a5d9b7534325 (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 155a4e664b51ed6742ca8adffbdc60f1059a9c30
Author: Sandro Santilli <strk at kbt.io>
Date:   Tue May 4 18:13:22 2021 +0200

    Move hard-coded upgrade data from run_test.pl to hook scripts

diff --git a/GNUmakefile.in b/GNUmakefile.in
index 8203a16..963bcb9 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -41,7 +41,7 @@ clean-local:
 # TODO: drop 'test' target..
 test: check
 
-check: check-no-trailing-blanks check-unit check-regress docs-check check-news 
+check: check-no-trailing-blanks check-unit check-regress docs-check check-news
 
 staged-install: all
 	$(MAKE) -C regress staged-install
@@ -197,11 +197,9 @@ ifeq ($(HAVE_SFCGAL),yes)
 	include sfcgal/regress/tests.mk
 endif
 ifeq (@TOPOLOGY@,topology)
-	override RUNTESTFLAGS := $(RUNTESTFLAGS) --topology
 	include topology/test/tests.mk
 endif
 ifeq (@RASTER@,raster)
-	override RUNTESTFLAGS := $(RUNTESTFLAGS) --raster
 	include raster/test/regress/tests.mk
 endif
 
diff --git a/raster/test/regress/Makefile.in b/raster/test/regress/Makefile.in
index 5c0ea48..9117380 100644
--- a/raster/test/regress/Makefile.in
+++ b/raster/test/regress/Makefile.in
@@ -180,9 +180,8 @@ rtpostgis.sql: ../../rt_pg/rtpostgis.sql
 	$(PERL) -lpe "s'\\\$$libdir'$(REGRESS_INSTALLDIR)/lib'g" $< > $@
 
 
-override RUNTESTFLAGS := $(RUNTESTFLAGS) --raster
-
 topsrcdir = $(realpath ../../../)
+srcdir = $(realpath .)
 
 include tests.mk
 include ../../../regress/runtest.mk
diff --git a/raster/test/regress/hooks/hook-after-upgrade-raster.sql b/raster/test/regress/hooks/hook-after-upgrade-raster.sql
new file mode 100644
index 0000000..49f5117
--- /dev/null
+++ b/raster/test/regress/hooks/hook-after-upgrade-raster.sql
@@ -0,0 +1 @@
+DROP TABLE upgrade_test_raster;
diff --git a/raster/test/regress/hooks/hook-before-upgrade-raster.sql b/raster/test/regress/hooks/hook-before-upgrade-raster.sql
new file mode 100644
index 0000000..8c000db
--- /dev/null
+++ b/raster/test/regress/hooks/hook-before-upgrade-raster.sql
@@ -0,0 +1,16 @@
+CREATE TABLE upgrade_test_raster(r raster);
+INSERT INTO upgrade_test_raster(r) VALUES
+(
+	ST_AddBand(
+		ST_MakeEmptyRaster(
+			10, 10, 1, 1, 2, 2, 0, 0,4326
+		),
+		1,
+		'8BSI'::text,
+		-129,
+		NULL
+	)
+);
+
+--SET client_min_messages TO ERROR;
+SELECT AddRasterConstraints('upgrade_test_raster', 'r');
diff --git a/raster/test/regress/tests.mk b/raster/test/regress/tests.mk
index 07fc69e..db11bdd 100644
--- a/raster/test/regress/tests.mk
+++ b/raster/test/regress/tests.mk
@@ -10,6 +10,12 @@
 # *
 # **********************************************************************
 
+override RUNTESTFLAGS := $(RUNTESTFLAGS) --raster
+
+RUNTESTFLAGS_INTERNAL += \
+  --before-upgrade-script $(topsrcdir)/raster/test/regress/hooks/hook-before-upgrade-raster.sql \
+  --after-upgrade-script  $(topsrcdir)/raster/test/regress/hooks/hook-after-upgrade-raster.sql
+
 RASTER_TEST_FIRST = \
 	$(topsrcdir)/raster/test/regress/check_gdal \
 	$(topsrcdir)/raster/test/regress/load_outdb
diff --git a/regress/core/tests.mk.in b/regress/core/tests.mk.in
index 876dead..e8c8102 100644
--- a/regress/core/tests.mk.in
+++ b/regress/core/tests.mk.in
@@ -20,6 +20,10 @@ INTERRUPTTESTS=@INTERRUPTTESTS@
 
 current_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
 
+RUNTESTFLAGS_INTERNAL += \
+  --before-upgrade-script $(topsrcdir)/regress/hooks/hook-before-upgrade.sql \
+  --after-upgrade-script  $(topsrcdir)/regress/hooks/hook-after-upgrade.sql
+
 TESTS += \
 	$(topsrcdir)/regress/core/affine \
 	$(topsrcdir)/regress/core/bestsrid \
@@ -153,7 +157,7 @@ endif
 
 ifeq ($(shell expr "$(POSTGIS_GEOS_VERSION)" ">=" 31000),1)
 	TESTS += \
-		$(topsrcdir)/regress/core/geos310 
+		$(topsrcdir)/regress/core/geos310
 endif
 
 ifeq ($(INTERRUPTTESTS),yes)
diff --git a/regress/hooks/hook-after-upgrade.sql b/regress/hooks/hook-after-upgrade.sql
new file mode 100644
index 0000000..459f802
--- /dev/null
+++ b/regress/hooks/hook-after-upgrade.sql
@@ -0,0 +1,2 @@
+DROP VIEW IF EXISTS upgrade_view_test;
+DROP TABLE upgrade_test;
diff --git a/regress/hooks/hook-before-upgrade.sql b/regress/hooks/hook-before-upgrade.sql
new file mode 100644
index 0000000..d4bcb8c
--- /dev/null
+++ b/regress/hooks/hook-before-upgrade.sql
@@ -0,0 +1,26 @@
+CREATE TABLE upgrade_test(g1 geometry, g2 geography);
+INSERT INTO upgrade_test(g1,g2) VALUES
+('POINT(0 0)', 'LINESTRING(0 0, 1 1)'),
+('POINT(1 0)', 'LINESTRING(0 1, 1 1)');
+
+-- We know upgrading with an st_union() based view
+-- fails unless you're on PostgreSQL 12, so we don't
+-- even try that.
+--
+-- We could re-enable this test IF we fix the upgrade
+-- in pre-12 versions. Refer to
+-- https://trac.osgeo.org/postgis/ticket/4386
+--
+DO $BODY$
+DECLARE
+	vernum INT;
+BEGIN
+	show server_version_num INTO vernum;
+	IF vernum >= 120000
+	THEN
+		RAISE DEBUG '12+ server (%)', vernum;
+    CREATE VIEW upgrade_view_test AS
+    SELECT ST_Union(g1) FROM upgrade_test;
+	END IF;
+END;
+$BODY$ LANGUAGE 'plpgsql';
diff --git a/regress/run_test.pl b/regress/run_test.pl
index 72b254e..938439c 100755
--- a/regress/run_test.pl
+++ b/regress/run_test.pl
@@ -94,7 +94,7 @@ GetOptions (
 	'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
+	'after-upgrade-script=s' => \@OPT_HOOK_AFTER_UPGRADE
 	);
 
 if ( @ARGV < 1 )
@@ -297,114 +297,6 @@ sub semver_lessthan
 	return @bcomp ? 1 : 0;
 }
 
-sub create_upgrade_test_objects
-{
-
-  # 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 );
-  $query .= ")";
-  my $ret = sql($query);
-  unless ( $ret =~ /^CREATE/ ) {
-    `dropdb $DB`;
-    print "\nSomething went wrong creating upgrade_test table: $ret.\n";
-    exit(1);
-  }
-
-  $query = "insert into upgrade_test(g1,g2) values ";
-	$query .= "('POINT(0 0)', 'LINESTRING(0 0, 1 1)'), ";
-	$query .= "('POINT(1 0)', 'LINESTRING(0 1, 1 1)');";
-  my $ret = sql($query);
-  unless ( $ret =~ /^INSERT/ ) {
-    `dropdb $DB`;
-    print "\nSomething went wrong populating upgrade_test table: $ret.\n";
-    exit(1);
-  }
-
-
-  if ( $pgvernum >= 120000 ) {
-    # We know upgrading with an st_union() based view
-    # fails unless you're on PostgreSQL 12, so we don't
-    # even try that.
-    #
-    # We could re-enable this test IF we fix the upgrade
-    # in pre-12 versions. Refer to
-    # https://trac.osgeo.org/postgis/ticket/4386
-    #
-    $query = "create view upgrade_view_test as ";
-    $query .= "select st_union(g1) from upgrade_test;";
-    my $ret = sql($query);
-    unless ( $ret =~ /^CREATE/ ) {
-      `dropdb $DB`;
-      print "\nSomething went wrong creating upgrade_view_test view: $ret.\n";
-      exit(1);
-    }
-  }
-
-  if ( $OPT_WITH_RASTER )
-  {
-    $query = "UPDATE upgrade_test SET r = ";
-    $query .= " ST_AddBand(ST_MakeEmptyRaster(10, 10, 1, 1, 2, 2, 0, 0,4326), 1, '8BSI'::text, -129, NULL);";
-    $ret = sql($query);
-    unless ( $ret =~ /^UPDATE/ ) {
-      `dropdb $DB`;
-      print "\nSomething went wrong setting raster into upgrade_test table: $ret.\n";
-      exit(1);
-    }
-
-    $query = "set client_min_messages to error; select AddRasterConstraints('upgrade_test', 'r')";
-    $ret = sql($query);
-    unless ( $ret =~ /^t$/ ) {
-      `dropdb $DB`;
-      print "\nSomething went wrong adding raster constraints to upgrade_test: " . $ret . "\n";
-      exit(1);
-    }
-  }
-
-  if ( $OPT_WITH_TOPO )
-  {
-    $query = "select topology.createTopology('upgrade_test');";
-    $ret = sql($query);
-    unless ( $ret =~ /^[1-9][0-9]*$/ ) {
-      `dropdb $DB`;
-      print "\nSomething went wrong adding upgrade_test topology: " . $ret . "\n";
-      exit(1);
-    }
-  }
-}
-
-sub drop_upgrade_test_objects
-{
-  # TODO: allow passing the "upgrade-cleanup" script via commandline
-
-  my $ret = sql("drop view if exists upgrade_view_test;");
-  unless ( $ret =~ /^DROP/ ) {
-    `dropdb $DB`;
-    print "\nSomething went wrong dropping spatial view: $ret.\n";
-    exit(1);
-  }
-
-  my $ret = sql("drop table upgrade_test;");
-  unless ( $ret =~ /^DROP/ ) {
-    `dropdb $DB`;
-    print "\nSomething went wrong dropping spatial tables: $ret.\n";
-    exit(1);
-  }
-
-  if ( $OPT_WITH_TOPO )
-  {
-    my $query = "SELECT topology.DropTopology('upgrade_test');";
-    $ret = sql($query);
-    unless ( $ret =~ /^Topology 'upgrade_test' dropped$/ ) {
-      `dropdb $DB`;
-      print "\nSomething went wrong dropping upgrade_test topology: " . $ret . "\n";
-      exit(1);
-    }
-  }
-}
-
-
 if ( $OPT_UPGRADE )
 {
 	print "Upgrading from postgis $libver\n";
@@ -415,8 +307,6 @@ if ( $OPT_UPGRADE )
 		die unless load_sql_file($hook, 1);
 	}
 
-  create_upgrade_test_objects();
-
   if ( $OPT_EXTENSIONS )
   {
     upgrade_spatial_extensions();
@@ -426,11 +316,9 @@ if ( $OPT_UPGRADE )
 	  upgrade_spatial();
   }
 
-  drop_upgrade_test_objects();
-
 	foreach my $hook (@OPT_HOOK_AFTER_UPGRADE)
 	{
-		print "  Running after-upgrade-script $hook\n";
+		print "Running after-upgrade-script $hook\n";
 		die unless load_sql_file($hook, 1);
 	}
 
diff --git a/regress/runtest.mk b/regress/runtest.mk
index cd4cf26..5df1a39 100644
--- a/regress/runtest.mk
+++ b/regress/runtest.mk
@@ -4,17 +4,22 @@ abssrcdir := $(realpath .)
 TESTS := $(patsubst $(topsrcdir)/%,$(abstopsrcdir)/%,$(TESTS))
 TESTS := $(patsubst $(abssrcdir)/%,./%,$(TESTS))
 
-
 check-regress:
 
-	@$(PERL) $(topsrcdir)/regress/run_test.pl $(RUNTESTFLAGS) $(TESTS)
+	@echo "RUNTESTFLAGS: $(RUNTESTFLAGS)"
+	@echo "RUNTESTFLAGS_INTERNAL: $(RUNTESTFLAGS_INTERNAL)"
+
+	@$(PERL) $(topsrcdir)/regress/run_test.pl $(RUNTESTFLAGS) $(RUNTESTFLAGS_INTERNAL) $(TESTS)
 
 	#
 	# Will now run upgrade test if RUNTESTFLAGS was not already doing that
 	#
 
 	@if echo "$(RUNTESTFLAGS)" | grep -vq -- --upgrade; then \
-		$(PERL) $(topsrcdir)/regress/run_test.pl --upgrade $(RUNTESTFLAGS) $(TESTS); \
+		$(PERL) $(topsrcdir)/regress/run_test.pl \
+      --upgrade \
+      $(RUNTESTFLAGS) \
+      $(TESTS); \
 	fi
 
 check-long:
diff --git a/topology/test/Makefile.in b/topology/test/Makefile.in
index 732d01b..19d7770 100644
--- a/topology/test/Makefile.in
+++ b/topology/test/Makefile.in
@@ -39,9 +39,8 @@ check-regress: check-regress-deps
 
 check-regress-deps: topo_predicates.sql load_topology.sql load_topology-4326.sql
 
-override RUNTESTFLAGS := $(RUNTESTFLAGS) --topology
-
 topsrcdir = $(realpath ../../)
+srcdir = $(realpath .)
 
 include tests.mk
 include ../../regress/runtest.mk
diff --git a/topology/test/regress/hooks/hook-after-upgrade-topology.sql b/topology/test/regress/hooks/hook-after-upgrade-topology.sql
new file mode 100644
index 0000000..c7e2e9c
--- /dev/null
+++ b/topology/test/regress/hooks/hook-after-upgrade-topology.sql
@@ -0,0 +1,2 @@
+SELECT topology.DropTopology('upgrade_test');
+
diff --git a/topology/test/regress/hooks/hook-before-upgrade-topology.sql b/topology/test/regress/hooks/hook-before-upgrade-topology.sql
new file mode 100644
index 0000000..9c5529f
--- /dev/null
+++ b/topology/test/regress/hooks/hook-before-upgrade-topology.sql
@@ -0,0 +1,2 @@
+SELECT topology.createTopology('upgrade_test');
+
diff --git a/topology/test/tests.mk b/topology/test/tests.mk
index 2d8a8da..c2aa2f7 100644
--- a/topology/test/tests.mk
+++ b/topology/test/tests.mk
@@ -10,6 +10,12 @@
 # *
 # **********************************************************************
 
+override RUNTESTFLAGS := $(RUNTESTFLAGS) --topology
+
+RUNTESTFLAGS_INTERNAL += \
+  --before-upgrade-script $(topsrcdir)/topology/test/regress/hooks/hook-before-upgrade-topology.sql \
+  --after-upgrade-script  $(topsrcdir)/topology/test/regress/hooks/hook-after-upgrade-topology.sql
+
 TESTS += \
   $(topsrcdir)/topology/test/regress/addedge.sql \
 	$(topsrcdir)/topology/test/regress/addface2.5d.sql \

commit 30706a68a780d6a1555f950f7bae673e649d64ef
Author: Sandro Santilli <strk at kbt.io>
Date:   Tue May 4 22:58:01 2021 +0200

    gitlab-ci: avoid unit tests when testing dump/restore

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 175ca4d..30457ff 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,7 +19,7 @@ test:
     - ./configure CFLAGS="-Wall -fno-omit-frame-pointer -Werror"
     - make
     - RUNTESTFLAGS=-v make check
-    - RUNTESTFLAGS="-v --dumprestore" make check
+    - RUNTESTFLAGS="-v --dumprestore" make check-regress
     - make install
     - RUNTESTFLAGS=-v make installcheck
     - RUNTESTFLAGS="-v --dumprestore" make installcheck

-----------------------------------------------------------------------

Summary of changes:
 .gitlab-ci.yml                                     |   2 +-
 GNUmakefile.in                                     |   4 +-
 raster/test/regress/Makefile.in                    |   3 +-
 .../regress/hooks/hook-after-upgrade-raster.sql    |   1 +
 .../regress/hooks/hook-before-upgrade-raster.sql   |  16 +++
 raster/test/regress/tests.mk                       |   6 ++
 regress/core/tests.mk.in                           |   6 +-
 regress/hooks/hook-after-upgrade.sql               |   2 +
 regress/hooks/hook-before-upgrade.sql              |  26 +++++
 regress/run_test.pl                                | 116 +--------------------
 regress/runtest.mk                                 |  11 +-
 topology/test/Makefile.in                          |   3 +-
 .../regress/hooks/hook-after-upgrade-topology.sql  |   2 +
 .../regress/hooks/hook-before-upgrade-topology.sql |   2 +
 topology/test/tests.mk                             |   6 ++
 15 files changed, 80 insertions(+), 126 deletions(-)
 create mode 100644 raster/test/regress/hooks/hook-after-upgrade-raster.sql
 create mode 100644 raster/test/regress/hooks/hook-before-upgrade-raster.sql
 create mode 100644 regress/hooks/hook-after-upgrade.sql
 create mode 100644 regress/hooks/hook-before-upgrade.sql
 create mode 100644 topology/test/regress/hooks/hook-after-upgrade-topology.sql
 create mode 100644 topology/test/regress/hooks/hook-before-upgrade-topology.sql


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list