From: Bborie Park Date: Tue, 23 Apr 2013 19:32:14 +0000 (+0000) Subject: Added bash versions of "bootstrapping" code for rt_addband test X-Git-Tag: 2.1.0beta2~91 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ce17c5337bf64706018c3339670199105cac3aa;p=postgis Added bash versions of "bootstrapping" code for rt_addband test git-svn-id: http://svn.osgeo.org/postgis/trunk@11312 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/test/regress/rt_addband-post.pl b/raster/test/regress/rt_addband-post.pl old mode 100644 new mode 100755 diff --git a/raster/test/regress/rt_addband-post.sh b/raster/test/regress/rt_addband-post.sh new file mode 100755 index 000000000..fe22c8ac9 --- /dev/null +++ b/raster/test/regress/rt_addband-post.sh @@ -0,0 +1,6 @@ +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +rm -f $DIR/$TEST-pre.sql +rm -f $DIR/$TEST-post.sql diff --git a/raster/test/regress/rt_addband-pre.pl b/raster/test/regress/rt_addband-pre.pl old mode 100644 new mode 100755 diff --git a/raster/test/regress/rt_addband-pre.sh b/raster/test/regress/rt_addband-pre.sh new file mode 100755 index 000000000..39251110f --- /dev/null +++ b/raster/test/regress/rt_addband-pre.sh @@ -0,0 +1,49 @@ +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +FILERASTER="$DIR/loader/testraster.tif" + +SQL=" \ +DROP TABLE IF EXISTS raster_outdb_template; \ +CREATE TABLE raster_outdb_template AS \ +SELECT \ + 1 AS rid, \ + ST_AddBand( \ + ST_MakeEmptyRaster(90, 90, 0., 0., 1, -1, 0, 0, 0), \ + 1, '$FILERASTER'::text, NULL::int[] \ + ) AS rast \ +UNION ALL \ +SELECT \ + 2 AS rid, \ + ST_AddBand( \ + ST_MakeEmptyRaster(90, 90, 0., 0., 1, -1, 0, 0, 0), \ + '$FILERASTER'::text, NULL::int[] \ + ) AS rast \ +UNION ALL \ +SELECT \ + 3 AS rid, \ + ST_AddBand( \ + ST_AddBand( \ + ST_MakeEmptyRaster(90, 90, 0., 0., 1, -1, 0, 0, 0), \ + 1, '8BUI', 1, 0 \ + ), \ + '$FILERASTER'::text, ARRAY[2]::int[] \ + ) AS rast \ +UNION ALL \ +SELECT \ + 4 AS rid, \ + ST_AddBand( \ + ST_AddBand( \ + ST_MakeEmptyRaster(90, 90, 0., 0., 1, -1, 0, 0, 0), \ + 1, '8BUI', 1, 0 \ + ), \ + '$FILERASTER'::text, ARRAY[2]::int[], \ + 1, \ + 255 \ + ) AS rast \ +" + +echo "$SQL" > $DIR/$TEST-pre.sql + +echo "DROP TABLE IF EXISTS raster_outdb_template;" > $DIR/$TEST-post.sql diff --git a/regress/run_test b/regress/run_test index 50b629b56..54b1e7fc9 100755 --- a/regress/run_test +++ b/regress/run_test @@ -1,16 +1,16 @@ #!/bin/sh -DB=postgis_reg +export DB=postgis_reg # TODO: get this part generated by ./configure. For now # we must make sure this matches REGRESS_INSTALLDIR in # Makefile.in. -SHP2PGSQL=../loader/shp2pgsql -PGSQL2SHP=../loader/pgsql2shp +export SHP2PGSQL=../loader/shp2pgsql +export PGSQL2SHP=../loader/pgsql2shp # raster2pgsql is relative to the place where this script # would be called: raster/test/regress -RASTER2PGSQL=../../loader/raster2pgsql +export RASTER2PGSQL=../../loader/raster2pgsql ################################################### # @@ -967,13 +967,14 @@ while [ -n "$1" ]; do # catch a common mistake (strip trailing .sql) TEST=`echo "$TEST" | sed 's/\.sql$//'` + export TEST start_test "${TEST}" # Check for a "-pre.sh" file in case there are non-SQL setup tasks needed before # the test can be run. if [ -r "${TEST}-pre.sh" ]; then - "${TEST}-pre.sh" + "./${TEST}-pre.sh" if [ $? -gt 0 ]; then fail " setup script failed" continue @@ -1027,7 +1028,7 @@ while [ -n "$1" ]; do # Check for a "-post.sh" file in case there are non-SQL teardown tasks needed after # the test has been run. if [ -r "${TEST}-post.sh" ]; then - "${TEST}-post.sh" + "./${TEST}-post.sh" if [ $? -gt 0 ]; then echo " ... but cleanup script failed!" fi