From: Paul Ramsey Date: Wed, 16 Mar 2011 14:06:54 +0000 (+0000) Subject: Jeff Adams new testing of loader with cmd line options. X-Git-Tag: 2.0.0alpha1~1895 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=723ec49f790affca43ed3a6f26b3594eeeb26cbd;p=postgis Jeff Adams new testing of loader with cmd line options. git-svn-id: http://svn.osgeo.org/postgis/trunk@6907 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/regress/loader/README b/regress/loader/README index 86bd83f9d..e9d206041 100644 --- a/regress/loader/README +++ b/regress/loader/README @@ -11,3 +11,9 @@ We need two separate tests for WKB and WKT as the WKT mode will not support M va Also, the tester script will dump the WKB loaded table and compare the resulting shapefile with the original one (only .shp, .dbf is not compared as field sizes are not retained, we might use a dbf viewer for that, but that's not currently implemented) + +Optional: + You may provide a .opts file to set custom command line options for shp2pgsql. + The first line that does not begin with a # is used. + + Also see ../README for a description of optional setup/teardown script files. diff --git a/regress/loader/TSIPolygon-wkb.expected b/regress/loader/TSIPolygon-wkb.expected new file mode 100644 index 000000000..1f4a60b57 --- /dev/null +++ b/regress/loader/TSIPolygon-wkb.expected @@ -0,0 +1 @@ +MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(5 5,8 5,8 8,5 8,5 5)),((-1 -1,-1 -10,-10 -10,-10 -1,-1 -1),(-5 -5,-8 -5,-8 -8,-5 -8,-5 -5))) diff --git a/regress/loader/TSIPolygon-wkb.sql b/regress/loader/TSIPolygon-wkb.sql new file mode 100644 index 000000000..e68081804 --- /dev/null +++ b/regress/loader/TSIPolygon-wkb.sql @@ -0,0 +1,2 @@ +select ST_Asewkt(the_geom) from loadedshp; + diff --git a/regress/loader/TSIPolygon-wkt.expected b/regress/loader/TSIPolygon-wkt.expected new file mode 100644 index 000000000..1f4a60b57 --- /dev/null +++ b/regress/loader/TSIPolygon-wkt.expected @@ -0,0 +1 @@ +MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(5 5,8 5,8 8,5 8,5 5)),((-1 -1,-1 -10,-10 -10,-10 -1,-1 -1),(-5 -5,-8 -5,-8 -8,-5 -8,-5 -5))) diff --git a/regress/loader/TSIPolygon-wkt.sql b/regress/loader/TSIPolygon-wkt.sql new file mode 100644 index 000000000..e68081804 --- /dev/null +++ b/regress/loader/TSIPolygon-wkt.sql @@ -0,0 +1,2 @@ +select ST_Asewkt(the_geom) from loadedshp; + diff --git a/regress/loader/TSIPolygon.dbf b/regress/loader/TSIPolygon.dbf new file mode 100644 index 000000000..13b4aeea0 Binary files /dev/null and b/regress/loader/TSIPolygon.dbf differ diff --git a/regress/loader/TSIPolygon.opts b/regress/loader/TSIPolygon.opts new file mode 100644 index 000000000..c3c86db0a --- /dev/null +++ b/regress/loader/TSIPolygon.opts @@ -0,0 +1,6 @@ +# You cannot create a test tablespace because tablespaces need to be directories that +# are owned by the postgres user, which is rarely the same as the user running the test, +# and you can't chown without sudo, so we gave up on trying to have a test that proves +# the -T and -X parameters work. However we can at least test that they don't cause +# any problems, which is what this test is for. +-X pg_default diff --git a/regress/loader/TSIPolygon.shp b/regress/loader/TSIPolygon.shp new file mode 100644 index 000000000..997b43fbe Binary files /dev/null and b/regress/loader/TSIPolygon.shp differ diff --git a/regress/loader/TSIPolygon.shx b/regress/loader/TSIPolygon.shx new file mode 100644 index 000000000..c16ea0a40 Binary files /dev/null and b/regress/loader/TSIPolygon.shx differ diff --git a/regress/loader/TSTIPolygon-wkb.expected b/regress/loader/TSTIPolygon-wkb.expected new file mode 100644 index 000000000..1f4a60b57 --- /dev/null +++ b/regress/loader/TSTIPolygon-wkb.expected @@ -0,0 +1 @@ +MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(5 5,8 5,8 8,5 8,5 5)),((-1 -1,-1 -10,-10 -10,-10 -1,-1 -1),(-5 -5,-8 -5,-8 -8,-5 -8,-5 -5))) diff --git a/regress/loader/TSTIPolygon-wkb.sql b/regress/loader/TSTIPolygon-wkb.sql new file mode 100644 index 000000000..e68081804 --- /dev/null +++ b/regress/loader/TSTIPolygon-wkb.sql @@ -0,0 +1,2 @@ +select ST_Asewkt(the_geom) from loadedshp; + diff --git a/regress/loader/TSTIPolygon-wkt.expected b/regress/loader/TSTIPolygon-wkt.expected new file mode 100644 index 000000000..1f4a60b57 --- /dev/null +++ b/regress/loader/TSTIPolygon-wkt.expected @@ -0,0 +1 @@ +MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(5 5,8 5,8 8,5 8,5 5)),((-1 -1,-1 -10,-10 -10,-10 -1,-1 -1),(-5 -5,-8 -5,-8 -8,-5 -8,-5 -5))) diff --git a/regress/loader/TSTIPolygon-wkt.sql b/regress/loader/TSTIPolygon-wkt.sql new file mode 100644 index 000000000..e68081804 --- /dev/null +++ b/regress/loader/TSTIPolygon-wkt.sql @@ -0,0 +1,2 @@ +select ST_Asewkt(the_geom) from loadedshp; + diff --git a/regress/loader/TSTIPolygon.dbf b/regress/loader/TSTIPolygon.dbf new file mode 100644 index 000000000..13b4aeea0 Binary files /dev/null and b/regress/loader/TSTIPolygon.dbf differ diff --git a/regress/loader/TSTIPolygon.opts b/regress/loader/TSTIPolygon.opts new file mode 100644 index 000000000..2ae143813 --- /dev/null +++ b/regress/loader/TSTIPolygon.opts @@ -0,0 +1,6 @@ +# You cannot create a test tablespace because tablespaces need to be directories that +# are owned by the postgres user, which is rarely the same as the user running the test, +# and you can't chown without sudo, so we gave up on trying to have a test that proves +# the -T and -X parameters work. However we can at least test that they don't cause +# any problems, which is what this test is for. +-T pg_default -X pg_default diff --git a/regress/loader/TSTIPolygon.shp b/regress/loader/TSTIPolygon.shp new file mode 100644 index 000000000..997b43fbe Binary files /dev/null and b/regress/loader/TSTIPolygon.shp differ diff --git a/regress/loader/TSTIPolygon.shx b/regress/loader/TSTIPolygon.shx new file mode 100644 index 000000000..c16ea0a40 Binary files /dev/null and b/regress/loader/TSTIPolygon.shx differ diff --git a/regress/loader/TSTPolygon-wkb.expected b/regress/loader/TSTPolygon-wkb.expected new file mode 100644 index 000000000..1f4a60b57 --- /dev/null +++ b/regress/loader/TSTPolygon-wkb.expected @@ -0,0 +1 @@ +MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(5 5,8 5,8 8,5 8,5 5)),((-1 -1,-1 -10,-10 -10,-10 -1,-1 -1),(-5 -5,-8 -5,-8 -8,-5 -8,-5 -5))) diff --git a/regress/loader/TSTPolygon-wkb.sql b/regress/loader/TSTPolygon-wkb.sql new file mode 100644 index 000000000..e68081804 --- /dev/null +++ b/regress/loader/TSTPolygon-wkb.sql @@ -0,0 +1,2 @@ +select ST_Asewkt(the_geom) from loadedshp; + diff --git a/regress/loader/TSTPolygon-wkt.expected b/regress/loader/TSTPolygon-wkt.expected new file mode 100644 index 000000000..1f4a60b57 --- /dev/null +++ b/regress/loader/TSTPolygon-wkt.expected @@ -0,0 +1 @@ +MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(5 5,8 5,8 8,5 8,5 5)),((-1 -1,-1 -10,-10 -10,-10 -1,-1 -1),(-5 -5,-8 -5,-8 -8,-5 -8,-5 -5))) diff --git a/regress/loader/TSTPolygon-wkt.sql b/regress/loader/TSTPolygon-wkt.sql new file mode 100644 index 000000000..e68081804 --- /dev/null +++ b/regress/loader/TSTPolygon-wkt.sql @@ -0,0 +1,2 @@ +select ST_Asewkt(the_geom) from loadedshp; + diff --git a/regress/loader/TSTPolygon.dbf b/regress/loader/TSTPolygon.dbf new file mode 100644 index 000000000..13b4aeea0 Binary files /dev/null and b/regress/loader/TSTPolygon.dbf differ diff --git a/regress/loader/TSTPolygon.opts b/regress/loader/TSTPolygon.opts new file mode 100644 index 000000000..d3b7053f9 --- /dev/null +++ b/regress/loader/TSTPolygon.opts @@ -0,0 +1,6 @@ +# You cannot create a test tablespace because tablespaces need to be directories that +# are owned by the postgres user, which is rarely the same as the user running the test, +# and you can't chown without sudo, so we gave up on trying to have a test that proves +# the -T and -X parameters work. However we can at least test that they don't cause +# any problems, which is what this test is for. +-T pg_default diff --git a/regress/loader/TSTPolygon.shp b/regress/loader/TSTPolygon.shp new file mode 100644 index 000000000..997b43fbe Binary files /dev/null and b/regress/loader/TSTPolygon.shp differ diff --git a/regress/loader/TSTPolygon.shx b/regress/loader/TSTPolygon.shx new file mode 100644 index 000000000..c16ea0a40 Binary files /dev/null and b/regress/loader/TSTPolygon.shx differ diff --git a/regress/run_test b/regress/run_test index 67ec01a28..5b215da34 100755 --- a/regress/run_test +++ b/regress/run_test @@ -210,6 +210,11 @@ run_loader_test () #echo "SELECT * from ${_tblname}" > ${TEST}.sql + # See if there is a custom command-line options file + if [ -r ${TEST}.opts ]; then + _custom_opts=`grep -v -m1 ^\s*# ${TEST}.opts` + fi + # # Run in HEXWKB insert mode @@ -217,7 +222,7 @@ run_loader_test () show_progress - ${SHP2PGSQL} -g the_geom ${TEST}.shp $_tblname \ + ${SHP2PGSQL} $_custom_opts -g the_geom ${TEST}.shp $_tblname \ > ${TMPDIR}/loader \ 2> ${TMPDIR}/loader.err