[Git][debian-gis-team/postgis][master] topology: Backport regression test update for geos 3.8 compatibility.

Christoph Berg gitlab at salsa.debian.org
Mon Oct 14 13:16:55 BST 2019



Christoph Berg pushed to branch master at Debian GIS Project / postgis


Commits:
1c80816f by Christoph Berg at 2019-10-14T12:16:36Z
topology: Backport regression test update for geos 3.8 compatibility.

- - - - -


3 changed files:

- debian/changelog
- debian/patches/series
- + debian/patches/topology-geos-3.8


Changes:

=====================================
debian/changelog
=====================================
@@ -6,6 +6,7 @@ postgis (2.5.3+dfsg-2) UNRELEASED; urgency=medium
     extension package.
   * debian/tests: Run regression tests.
   * regress: Backport fix for oriented-envelope test to be less sensitive.
+  * topology: Backport regression test update for geos 3.8 compatibility.
   * Add debian/.gitlab-ci.yml.
 
  -- Christoph Berg <myon at debian.org>  Fri, 11 Oct 2019 17:19:19 +0200


=====================================
debian/patches/series
=====================================
@@ -2,3 +2,4 @@ link-liblwgeom
 relax-test-timing-constraints.patch
 regress-pg-config
 regress-oriented-envelope
+topology-geos-3.8


=====================================
debian/patches/topology-geos-3.8
=====================================
@@ -0,0 +1,455 @@
+commit 2a9638df2e65eb50c11729d462f808012cf07279
+Author: Regina Obe <lr at pcorp.us>
+Date:   Sat Sep 28 00:41:04 2019 +0000
+
+    Missed some fixes in last commit.  this should work on all.
+    References #4514 for PostGIS 3.0
+
+    git-svn-id: http://svn.osgeo.org/postgis/trunk@17824 b70326c6-7e19-0410-871a-916f4a2858ee
+
+commit 73e5f0092b987b8d65d68d0513cb7a1948c62c25
+Author: Regina Obe <lr at pcorp.us>
+Date:   Fri Sep 27 23:59:30 2019 +0000
+
+    Revise topology tests so they yield same results in GEOS 3.8 and lower
+    References #4514 for PostGIS 3.0
+
+    git-svn-id: http://svn.osgeo.org/postgis/trunk@17823 b70326c6-7e19-0410-871a-916f4a2858ee
+
+--- a/topology/test/regress/topogeo_addlinestring.sql
++++ b/topology/test/regress/topogeo_addlinestring.sql
+@@ -12,7 +12,7 @@ SELECT 'max',* from city_data.limits;
+
+ -- Check changes since last saving, save more
+ -- {
+-CREATE OR REPLACE FUNCTION check_changes(lbl text)
++CREATE OR REPLACE FUNCTION check_changes(lbl text, add_id boolean default true)
+ RETURNS TABLE (o text)
+ AS $$
+ DECLARE
+@@ -20,9 +20,9 @@ DECLARE
+   sql text;
+ BEGIN
+   -- Check effect on nodes
+-  sql := 'SELECT $1 || ''|N|'' || n.node_id || ''|'' ||
++  sql :=  'SELECT $1 || ''|N|'' ' || CASE WHEN add_id THEN ' || n.node_id || ''|'' ||
+         COALESCE(n.containing_face::text,'''') || ''|'' ||
+-        ST_AsText(ST_SnapToGrid(n.geom, 0.2))::text as xx
++        ST_AsText(ST_SnapToGrid(n.geom, 0.2))::text ' ELSE '' END || ' as xx
+   	FROM city_data.node n WHERE n.node_id > (
+     		SELECT max FROM city_data.limits WHERE what = ''node''::text )
+   		ORDER BY n.node_id';
+@@ -34,16 +34,14 @@ BEGIN
+   END LOOP;
+
+   -- Check effect on edges (there should be one split)
+-  sql := '
+-  WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
++  sql := 'WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
+        edge_limits AS ( SELECT max FROM city_data.limits WHERE what = ''edge''::text )
+-  SELECT $1 || ''|E|'' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node :: text as xx
+-   FROM city_data.edge e, node_limits nl, edge_limits el
++  SELECT $1 || ''|E|'' ' || CASE WHEN add_id THEN ' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node::text ' ELSE '' END || ' AS xx ' ||
++   ' FROM city_data.edge e, node_limits nl, edge_limits el
+    WHERE e.start_node > nl.max
+       OR e.end_node > nl.max
+       OR e.edge_id > el.max
+-  ORDER BY e.edge_id;
+-  ';
++  ORDER BY e.edge_id;';
+
+   FOR rec IN EXECUTE sql USING ( lbl )
+   LOOP
+@@ -96,6 +94,8 @@ SELECT 'overlap', TopoGeo_addLineString(
+ SELECT check_changes('overlap');
+
+ -- Crossing
++-- TODO: Geos 3.8+ gives different results, so just returning the count of edge instead
++--       strk fix as you please leter
+ SELECT 'cross', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(49 18, 44 17)') ORDER BY 2;
+ SELECT check_changes('cross');
+
+@@ -106,14 +106,22 @@ SELECT 'snap_again', TopoGeo_addLineStri
+ SELECT check_changes('snap_again');
+
+ -- A mix of crossing and overlapping, splitting another face
+-SELECT 'crossover', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(9 18, 9 20, 21 10, 21 7)') ORDER BY 2;
+-SELECT check_changes('crossover');
+-SELECT 'crossover_again', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(9 18, 9 20, 21 10, 21 7)') ORDER BY 2;
+-SELECT check_changes('crossover_again');
++-- TODO: Geos 3.8+ gives different results, so just returning the count of edges instead
++--       strk fix as you please leter
++--SELECT 'crossover', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(9 18, 9 20, 21 10, 21 7)') ORDER BY 2;
++SELECT 'crossover', COUNT(*) FROM TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(9 18, 9 20, 21 10, 21 7)') AS t;
++SELECT check_changes('crossover', false);
++
++-- TODO: Geos 3.8+ gives different results, so just returning the count of edges instead
++--       strk fix as you please leter
++--SELECT 'crossover_again', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(9 18, 9 20, 21 10, 21 7)') ORDER BY 2;
++SELECT 'crossover_again', COUNT(*) FROM TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(9 18, 9 20, 21 10, 21 7)') AS t;
++SELECT check_changes('crossover_again', false);
+
+ -- Fully containing
+ SELECT 'contains', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(14 34, 13 35, 10 35, 9 35, 7 36)') ORDER BY 2;
+-SELECT check_changes('contains');
++-- answers different between 3.8 and older geos so disabling output of ids and geometry
++SELECT check_changes('contains', false);
+
+ -- Crossing a node
+ SELECT 'nodecross', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(18 37, 22 37)') ORDER BY 2;
+@@ -128,7 +136,7 @@ SELECT check_changes('iso_ex_2segs');
+ SELECT '#1613.1', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(556267.562954 144887.066638, 556267 144887.4)') ORDER BY 2;
+ SELECT check_changes('#1613.1');
+ SELECT '#1613.2', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(556250 144887, 556267 144887.07, 556310.04 144887)') ORDER BY 2;
+-SELECT check_changes('#1613.2');
++SELECT check_changes('#1613.2', false);
+
+ -- Consistency check
+ SELECT * FROM ValidateTopology('city_data');
+@@ -260,7 +268,7 @@ SELECT check_changes('#1714.2');
+ SELECT * FROM ValidateTopology('city_data');
+
+ -- Cleanups
+-DROP FUNCTION check_changes(text);
++DROP FUNCTION check_changes(text,boolean);
+ SELECT DropTopology('city_data');
+ DELETE FROM spatial_ref_sys where srid = 4326;
+
+@@ -320,7 +328,13 @@ SELECT 't3412.L1', TopoGeo_AddLinestring
+ 599671.37 4889781.87
+ )'
+ ::geometry, 0);
+-SELECT 't3412.L2', TopoGeo_AddLinestring('bug3412',
++
++-- TODO: answers different on 3.8 from older geos so revised test
++/**SELECT 't3412.L2', TopoGeo_AddLinestring('bug3412',
++'0102000000020000003AB42BBFEE4C22410010C5A997A6524167BB5DBDEE4C224117FE3DA85FA75241'
++::geometry, 0);**/
++SELECT 't3412.L2', COUNT(*)
++FROM TopoGeo_AddLinestring('bug3412',
+ '0102000000020000003AB42BBFEE4C22410010C5A997A6524167BB5DBDEE4C224117FE3DA85FA75241'
+ ::geometry, 0);
+ SELECT 't3412.end', DropTopology('bug3412');
+@@ -346,7 +360,13 @@ SELECT 't3838.L1', topology.TopoGeo_addL
+ 622598.73 6554996.23,
+ 622591.53 6554995.96)'
+ ::geometry , 1);
+-SELECT 't3838.L2', topology.TopoGeo_addLinestring('bug3838',
++-- TODO: answers in geos 3.8 different from older geos
++-- So just doing count instead of full test
++/** SELECT 't3838.L2', topology.TopoGeo_addLinestring('bug3838',
++'LINESTRING(622608 6554988, 622596 6554984)'
++::geometry , 10);**/
++SELECT 't3838.L2', COUNT(*)
++  FROM topology.TopoGeo_addLinestring('bug3838',
+ 'LINESTRING(622608 6554988, 622596 6554984)'
+ ::geometry , 10);
+ SELECT 't3838.end', topology.DropTopology('bug3838');
+--- a/topology/test/regress/topogeo_addlinestring_expected
++++ b/topology/test/regress/topogeo_addlinestring_expected
+@@ -56,36 +56,30 @@ snap|E|38|sn35|en36
+ snap_again|7
+ snap_again|36
+ snap_again|38
+-crossover|40
+-crossover|41
+-crossover|44
+-crossover|45
+-crossover|N|37||POINT(21 10)
+-crossover|N|38||POINT(21 7)
+-crossover|N|39||POINT(9 18)
+-crossover|N|40||POINT(9 20)
+-crossover|N|41||POINT(16.2 14)
+-crossover|E|9|sn15|en41
+-crossover|E|20|sn9|en38
+-crossover|E|21|sn15|en39
+-crossover|E|39|sn37|en14
+-crossover|E|40|sn38|en37
+-crossover|E|41|sn39|en40
+-crossover|E|42|sn40|en16
+-crossover|E|43|sn41|en14
+-crossover|E|44|sn41|en37
+-crossover|E|45|sn40|en41
+-crossover_again|40
+-crossover_again|41
+-crossover_again|44
+-crossover_again|45
++crossover|4
++crossover|N|
++crossover|N|
++crossover|N|
++crossover|N|
++crossover|N|
++crossover|E|
++crossover|E|
++crossover|E|
++crossover|E|
++crossover|E|
++crossover|E|
++crossover|E|
++crossover|E|
++crossover|E|
++crossover|E|
++crossover_again|4
+ contains|25
+ contains|46
+ contains|47
+-contains|N|42||POINT(7 36)
+-contains|N|43||POINT(14 34)
+-contains|E|46|sn21|en42
+-contains|E|47|sn43|en22
++contains|N|
++contains|N|
++contains|E|
++contains|E|
+ nodecross|48
+ nodecross|49
+ nodecross|N|44||POINT(18 37)
+@@ -99,13 +93,13 @@ iso_ex_2segs|28
+ #1613.1|E|50|sn46|en47
+ #1613.2|52
+ #1613.2|53
+-#1613.2|N|48||POINT(556267.6 144887)
+-#1613.2|N|49||POINT(556310 144887)
+-#1613.2|N|50||POINT(556250 144887)
+-#1613.2|E|50|sn46|en48
+-#1613.2|E|51|sn48|en47
+-#1613.2|E|52|sn48|en49
+-#1613.2|E|53|sn50|en48
++#1613.2|N|
++#1613.2|N|
++#1613.2|N|
++#1613.2|E|
++#1613.2|E|
++#1613.2|E|
++#1613.2|E|
+ #1631.1|54
+ #1631.1|N|51||POINT(556267.6 144887)
+ #1631.1|N|52||POINT(556267.6 144888)
+@@ -200,9 +194,6 @@ t3402.L2|3
+ t3402.end|Topology 'bug3402' dropped
+ t3412.start|t
+ t3412.L1|1
+-t3412.L2|2
+-t3412.L2|3
+-t3412.L2|5
+ t3412.L2|4
+ t3412.end|Topology 'bug3412' dropped
+ t3371.start|t
+@@ -212,15 +203,7 @@ t3371.L2|2
+ t3371.end|Topology 'bug3711' dropped
+ t3838.start|t
+ t3838.L1|1
+-t3838.L2|1
+-t3838.L2|3
+-t3838.L2|4
+-t3838.L2|5
+-t3838.L2|6
+-t3838.L2|7
+-t3838.L2|8
+ t3838.L2|9
+-t3838.L2|2
+ t3838.end|Topology 'bug3838' dropped
+ t1855_1.start|t
+ t1855_1.0|1
+--- a/topology/test/regress/topogeo_addpolygon.sql
++++ b/topology/test/regress/topogeo_addpolygon.sql
+@@ -11,7 +11,7 @@ SELECT 'max',* from city_data.limits;
+
+ -- Check changes since last saving, save more
+ -- {
+-CREATE OR REPLACE FUNCTION check_changes()
++CREATE OR REPLACE FUNCTION check_changes(lbl text, add_id boolean default true)
+ RETURNS TABLE (o text)
+ AS $$
+ DECLARE
+@@ -19,45 +19,43 @@ DECLARE
+   sql text;
+ BEGIN
+   -- Check effect on nodes
+-  sql := 'SELECT n.node_id, ''N|'' || n.node_id || ''|'' ||
++  sql :=  'SELECT $1 || ''|N|'' ' || CASE WHEN add_id THEN ' || n.node_id || ''|'' ' ELSE '' END || ' ||
+         COALESCE(n.containing_face::text,'''') || ''|'' ||
+         ST_AsText(ST_SnapToGrid(n.geom, 0.2))::text as xx
+   	FROM city_data.node n WHERE n.node_id > (
+     		SELECT max FROM city_data.limits WHERE what = ''node''::text )
+   		ORDER BY n.node_id';
+
+-  FOR rec IN EXECUTE sql LOOP
++  FOR rec IN EXECUTE sql USING ( lbl )
++  LOOP
+     o := rec.xx;
+     RETURN NEXT;
+   END LOOP;
+
+-  -- Check effect on edges
+-  sql := '
+-  WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
++  -- Check effect on edges (there should be one split)
++  sql := 'WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
+        edge_limits AS ( SELECT max FROM city_data.limits WHERE what = ''edge''::text )
+-  SELECT ''E|'' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node :: text as xx
+-   FROM city_data.edge e, node_limits nl, edge_limits el
++  SELECT $1 || ''|E|'' ' || CASE WHEN add_id THEN ' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node::text ' ELSE '' END || ' AS xx ' ||
++   ' FROM city_data.edge e, node_limits nl, edge_limits el
+    WHERE e.start_node > nl.max
+       OR e.end_node > nl.max
+       OR e.edge_id > el.max
+-  ORDER BY e.edge_id;
+-  ';
++  ORDER BY e.edge_id;';
+
+-  FOR rec IN EXECUTE sql LOOP
++  FOR rec IN EXECUTE sql USING ( lbl )
++  LOOP
+     o := rec.xx;
+     RETURN NEXT;
+   END LOOP;
+
+   -- Check effect on faces
+-  sql := '
+-  WITH face_limits AS ( SELECT max FROM city_data.limits WHERE what = ''face''::text )
+-  SELECT ''F|'' || f.face_id ::text as xx
++  sql := 'WITH face_limits AS ( SELECT max FROM city_data.limits WHERE what = ''face''::text )
++  SELECT $1 || ''|F|'' ' || CASE WHEN add_id THEN ' || f.face_id ::text ' ELSE '' END || ' as xx
+    FROM city_data.face f, face_limits fl
+    WHERE f.face_id > fl.max
+-  ORDER BY f.face_id;
+-  ';
++  ORDER BY f.face_id;';
+
+-  FOR rec IN EXECUTE sql LOOP
++  FOR rec IN EXECUTE sql USING ( lbl ) LOOP
+     o := rec.xx;
+     RETURN NEXT;
+   END LOOP;
+@@ -77,37 +75,39 @@ SELECT 'invalid', TopoGeo_addPolygon('in
+
+ -- Isolated face in universal face
+ SELECT 'iso_uni', TopoGeo_addPolygon('city_data', 'POLYGON((36 26, 38 30, 43 26, 36 26))');
+-SELECT check_changes();
++SELECT check_changes('iso_uni');
+
+ -- Isolated face in universal face with hole
+ SELECT 'iso_uni_hole', TopoGeo_addPolygon('city_data', 'POLYGON((9 28, 16 29, 16 23, 10 23, 9 28),(15 25, 13 27, 11 24, 15 25))');
+-SELECT check_changes();
++SELECT check_changes('iso_uni_hole');
+
+ -- Existing single face
+ SELECT 'ex', TopoGeo_addPolygon('city_data', 'POLYGON((21 22,35 22,35 14,21 14,21 22))');
+-SELECT check_changes();
++SELECT check_changes('ex');
+
+ -- Union of existing faces
+ SELECT 'ex_union', TopoGeo_addPolygon('city_data', 'POLYGON((9 14,21 14,35 14,35 6,21 6,9 6,9 14))') ORDER BY 2;
+-SELECT check_changes();
++SELECT check_changes('ex_union');
+
+ -- Half an existing face
+ SELECT 'half', TopoGeo_addPolygon('city_data', 'POLYGON((21 14, 35 22, 35 14, 21 14))');
+-SELECT check_changes();
++SELECT check_changes('half');
+
+ -- Split two existing faces
+ SELECT 'split', TopoGeo_addPolygon('city_data', 'POLYGON((21 14, 21 22, 35 14, 21 14))') ORDER BY 2;
+-SELECT check_changes();
++-- TODO: strk changed to not output the node/edge/face ids as they have different answers in 3.8
++-- Revise your code if you don't like it
++SELECT check_changes('split', false);
+
+ -- Union of existing face, with hole
+ SELECT 'ex_hole', TopoGeo_addPolygon('city_data', 'POLYGON((9 22,47 22,47 6,9 6,9 22),(21 14,28 18,35 14,21 14))') ORDER BY 2;
+-SELECT check_changes();
++SELECT check_changes('ex_hole');
+
+ -- Union of existing face, with hole and a tolerance
+ SELECT 'ex_hole_snap', TopoGeo_addPolygon('city_data', 'POLYGON((9 22,35 22.5, 47 22,47 6,9 6,9 22),(21 14,28 17.5,35 14,21 14))', 1) ORDER BY 2;
+-SELECT check_changes();
++SELECT check_changes('ex_hole_snap');
+
+-DROP FUNCTION check_changes();
++DROP FUNCTION check_changes(text,boolean);
+ SELECT DropTopology('city_data');
+
+ -- See https://trac.osgeo.org/postgis/ticket/1855
+@@ -137,9 +137,19 @@ SELECT 't1946.1', topology.topogeo_AddPo
+           76.68727 30.74249,76.68727 30.74248,
+           76.68726 30.74248,76.68554 30.74))'
+ ::geometry);
+-SELECT 't1946.2', topology.topogeo_AddPolygon('bug1946',
++
++-- TODO: Geos 3.8+ returns different answer with original test
++-- strk if you are not happy with my change change it
++/**SELECT 't1946.2', topology.topogeo_AddPolygon('bug1946',
+ 'POLYGON((76.68728 30.74248,76.68727 30.74248,
+           76.68727 30.74249,76.67933 30.75,
+           76.69223 30.74157,76.68728 30.74248))'
+-::geometry);
++::geometry);  **/
++SELECT 't1946.2', COUNT(*)
++  FROM topology.topogeo_AddPolygon('bug1946',
++'POLYGON((76.68728 30.74248,76.68727 30.74248,
++          76.68727 30.74249,76.67933 30.75,
++          76.69223 30.74157,76.68728 30.74248))'
++::geometry);
++
+ SELECT 't1946.end', topology.DropTopology('bug1946');
+--- a/topology/test/regress/topogeo_addpolygon_expected
++++ b/topology/test/regress/topogeo_addpolygon_expected
+@@ -11,31 +11,31 @@ ERROR:  Invalid geometry type (MULTILINE
+ ERROR:  Invalid geometry type (POINT) passed to TopoGeo_AddPolygon, expected POLYGON
+ ERROR:  No topology with name "invalid" in topology.topology
+ iso_uni|10
+-N|23||POINT(36 26)
+-E|27|sn23|en23
+-F|10
++iso_uni|N|23||POINT(36 26)
++iso_uni|E|27|sn23|en23
++iso_uni|F|10
+ iso_uni_hole|11
+-N|24||POINT(9 28)
+-N|25||POINT(15 25)
+-E|28|sn24|en24
+-E|29|sn25|en25
+-F|11
+-F|12
++iso_uni_hole|N|24||POINT(9 28)
++iso_uni_hole|N|25||POINT(15 25)
++iso_uni_hole|E|28|sn24|en24
++iso_uni_hole|E|29|sn25|en25
++iso_uni_hole|F|11
++iso_uni_hole|F|12
+ ex|4
+ ex_union|6
+ ex_union|7
+ half|4
+-E|30|sn14|en18
+-F|13
++half|E|30|sn14|en18
++half|F|13
+ split|4
+ split|13
+-N|26||POINT(28 18)
+-E|30|sn14|en26
+-E|31|sn26|en18
+-E|32|sn26|en13
+-E|33|sn17|en26
+-F|14
+-F|15
++split|N||POINT(28 18)
++split|E|
++split|E|
++split|E|
++split|E|
++split|F|
++split|F|
+ ex_hole|3
+ ex_hole|5
+ ex_hole|6
+@@ -60,5 +60,5 @@ t1855_0.end|Topology 'bug1855' dropped
+ t1946.start|t
+ t1946.0|1
+ t1946.1|2
+-t1946.2|4
++t1946.2|1
+ t1946.end|Topology 'bug1946' dropped



View it on GitLab: https://salsa.debian.org/debian-gis-team/postgis/commit/1c80816f024d0fc77685f4524197353f609be988

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/postgis/commit/1c80816f024d0fc77685f4524197353f609be988
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20191014/becca41b/attachment-0001.html>


More information about the Pkg-grass-devel mailing list