]> granicus.if.org Git - postgis/commitdiff
Added bash versions of "bootstrapping" code for rt_addband test
authorBborie Park <bkpark at ucdavis.edu>
Tue, 23 Apr 2013 19:32:14 +0000 (19:32 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Tue, 23 Apr 2013 19:32:14 +0000 (19:32 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11312 b70326c6-7e19-0410-871a-916f4a2858ee

raster/test/regress/rt_addband-post.pl [changed mode: 0644->0755]
raster/test/regress/rt_addband-post.sh [new file with mode: 0755]
raster/test/regress/rt_addband-pre.pl [changed mode: 0644->0755]
raster/test/regress/rt_addband-pre.sh [new file with mode: 0755]
regress/run_test

old mode 100644 (file)
new mode 100755 (executable)
diff --git a/raster/test/regress/rt_addband-post.sh b/raster/test/regress/rt_addband-post.sh
new file mode 100755 (executable)
index 0000000..fe22c8a
--- /dev/null
@@ -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
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/raster/test/regress/rt_addband-pre.sh b/raster/test/regress/rt_addband-pre.sh
new file mode 100755 (executable)
index 0000000..3925111
--- /dev/null
@@ -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
index 50b629b56353a00a3873abff81cada7d322385d2..54b1e7fc97a443deaab9334f1570f21ac9629a00 100755 (executable)
@@ -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