]> granicus.if.org Git - postgis/commitdiff
Refactored use of out-db rasters for regression tests
authorBborie Park <bkpark at ucdavis.edu>
Fri, 24 May 2013 17:27:48 +0000 (17:27 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Fri, 24 May 2013 17:27:48 +0000 (17:27 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11496 b70326c6-7e19-0410-871a-916f4a2858ee

18 files changed:
raster/test/regress/Makefile.in
raster/test/regress/clean.sql [new file with mode: 0644]
raster/test/regress/clean_expected [new file with mode: 0644]
raster/test/regress/load_outdb-post.pl [moved from raster/test/regress/rt_addband-post.pl with 79% similarity]
raster/test/regress/load_outdb-post.sh [moved from raster/test/regress/rt_utility-post.sh with 85% similarity]
raster/test/regress/load_outdb-pre.pl [moved from raster/test/regress/rt_bytea-pre.pl with 85% similarity]
raster/test/regress/load_outdb-pre.sh [moved from raster/test/regress/rt_utility-pre.sh with 90% similarity]
raster/test/regress/load_outdb.sql [new file with mode: 0644]
raster/test/regress/load_outdb_expected [new file with mode: 0644]
raster/test/regress/rt_addband-post.sh [deleted file]
raster/test/regress/rt_addband-pre.pl [deleted file]
raster/test/regress/rt_addband-pre.sh [deleted file]
raster/test/regress/rt_bytea-post.pl [deleted file]
raster/test/regress/rt_bytea-post.sh [deleted file]
raster/test/regress/rt_bytea-pre.sh [deleted file]
raster/test/regress/rt_utility-post.pl [deleted file]
raster/test/regress/rt_utility-pre.pl [deleted file]
regress/run_test.pl

index 161f746d4c1ac2944fa1d59fd3b57383c3a7e96f..8161dbb9053f2312c9a21e560047cc10b2341f0a 100644 (file)
@@ -30,7 +30,11 @@ PATH := $(PGSQL_BINDIR):$(PATH)
 export PATH
 
 TEST_FIRST = \
-       check_gdal
+       check_gdal \
+       load_outdb
+
+TEST_LAST = \
+       clean
 
 TEST_METADATA = \
        check_raster_columns \
@@ -131,11 +135,13 @@ TEST_LOADER = \
        loader/Tiled10x10Copy \
        loader/Tiled8x8
 
-TESTS = $(TEST_FIRST) $(TEST_METADATA) $(TEST_IO) $(TEST_BASIC_FUNC) \
-               $(TEST_PROPS) $(TEST_BANDPROPS) \
-               $(TEST_UTILITY) $(TEST_MAPALGEBRA) $(TEST_SREL) \
-               $(TEST_BUGS) \
-               $(TEST_LOADER)
+TESTS = $(TEST_FIRST) \
+       $(TEST_METADATA) $(TEST_IO) $(TEST_BASIC_FUNC) \
+       $(TEST_PROPS) $(TEST_BANDPROPS) \
+       $(TEST_UTILITY) $(TEST_MAPALGEBRA) $(TEST_SREL) \
+       $(TEST_BUGS) \
+       $(TEST_LOADER) \
+       $(TEST_LAST)
 
 all:
        @echo "Use 'make check' to run all tests"
diff --git a/raster/test/regress/clean.sql b/raster/test/regress/clean.sql
new file mode 100644 (file)
index 0000000..b96c2d4
--- /dev/null
@@ -0,0 +1,4 @@
+SET client_min_messages TO warning;
+
+-- remove raster_outdb_template table
+DROP TABLE IF EXISTS raster_outdb_template;
diff --git a/raster/test/regress/clean_expected b/raster/test/regress/clean_expected
new file mode 100644 (file)
index 0000000..e69de29
similarity index 79%
rename from raster/test/regress/rt_addband-post.pl
rename to raster/test/regress/load_outdb-post.pl
index a48c932ff6dc5436609daf9b685cc5a50078de51..54c91a3bf8bf5d23c7d02c720e1b1e5bb58cc2a6 100755 (executable)
@@ -5,4 +5,4 @@ my $REGDIR = abs_path(dirname($0));
 my $RASTERDIR = abs_path($REGDIR . "/../raster/test/regress");
 
 unlink $RASTERDIR . '/' . $TEST . '-pre.sql';
-unlink $RASTERDIR . '/' . $TEST . '-post.sql';
+#unlink $RASTERDIR . '/' . $TEST . '-post.sql';
similarity index 85%
rename from raster/test/regress/rt_utility-post.sh
rename to raster/test/regress/load_outdb-post.sh
index e17075809a1a715db70d0e4be735d6263b0451dd..914c97b309d8c910fefd7efbefa5720a9094716c 100755 (executable)
@@ -3,4 +3,4 @@ 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"
+#rm -f "$DIR/$TEST-post.sql"
similarity index 85%
rename from raster/test/regress/rt_bytea-pre.pl
rename to raster/test/regress/load_outdb-pre.pl
index 772877df5c0445230b1c8bea59511062306c5db5..530c3fb0b8bab23c27a8cfb3feead6783e6351c1 100755 (executable)
@@ -56,6 +56,7 @@ open(PRESQL, '>', $RASTERDIR . '/' . $TEST . '-pre.sql');
 print PRESQL $sql;
 close(PRESQL);
 
-open(POSTSQL, '>', $RASTERDIR . '/' . $TEST . '-post.sql');
-print POSTSQL "DROP TABLE IF EXISTS raster_outdb_template;\n";
-close(POSTSQL);
+# no longer needed as the "clean" test takes care of it
+#open(POSTSQL, '>', $RASTERDIR . '/' . $TEST . '-post.sql');
+#print POSTSQL "DROP TABLE IF EXISTS raster_outdb_template;\n";
+#close(POSTSQL);
similarity index 90%
rename from raster/test/regress/rt_utility-pre.sh
rename to raster/test/regress/load_outdb-pre.sh
index 6102ed058e1cce039afd0676199d8251b0b0989b..b085761ed528a7d65fd26035b652041c52c5bf17 100755 (executable)
@@ -52,4 +52,5 @@ SELECT \
 
 echo "$SQL" > "$DIR/$TEST-pre.sql"
 
-echo "DROP TABLE IF EXISTS raster_outdb_template;" > "$DIR/$TEST-post.sql"
+# no longer needed as "clean" test takes care of it
+#echo "DROP TABLE IF EXISTS raster_outdb_template;" > "$DIR/$TEST-post.sql"
diff --git a/raster/test/regress/load_outdb.sql b/raster/test/regress/load_outdb.sql
new file mode 100644 (file)
index 0000000..a14a055
--- /dev/null
@@ -0,0 +1 @@
+SELECT count(*) FROM raster_outdb_template;
diff --git a/raster/test/regress/load_outdb_expected b/raster/test/regress/load_outdb_expected
new file mode 100644 (file)
index 0000000..b8626c4
--- /dev/null
@@ -0,0 +1 @@
+4
diff --git a/raster/test/regress/rt_addband-post.sh b/raster/test/regress/rt_addband-post.sh
deleted file mode 100755 (executable)
index e170758..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-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
deleted file mode 100755 (executable)
index 772877d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-use File::Basename;
-use Cwd 'abs_path';
-
-my $REGDIR = abs_path(dirname($0));
-my $RASTERDIR = abs_path($REGDIR . "/../raster/test/regress");
-my $FILERASTER = $RASTERDIR . "/loader/testraster.tif";
-
-# special handling for msys
-if (lc($^O) eq "msys") {
-       $FILERASTER = `cmd //c echo "$FILERASTER"`;
-       $FILERASTER =~ s/^\s+//;
-       $FILERASTER =~ s/\s+$//;
-}
-
-my $sql = <<"END";
-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
-END
-
-open(PRESQL, '>', $RASTERDIR . '/' . $TEST . '-pre.sql');
-print PRESQL $sql;
-close(PRESQL);
-
-open(POSTSQL, '>', $RASTERDIR . '/' . $TEST . '-post.sql');
-print POSTSQL "DROP TABLE IF EXISTS raster_outdb_template;\n";
-close(POSTSQL);
diff --git a/raster/test/regress/rt_addband-pre.sh b/raster/test/regress/rt_addband-pre.sh
deleted file mode 100755 (executable)
index 6102ed0..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-FILERASTER="$DIR/loader/testraster.tif"
-
-# special handling for msys
-CSYS=`uname -o | tr '[:upper:]' '[:lower:]'`
-if [ "$CSYS" == "msys" ]; then
-       FILERASTER=`cmd //c echo "${FILERASTER}"`
-fi
-
-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/raster/test/regress/rt_bytea-post.pl b/raster/test/regress/rt_bytea-post.pl
deleted file mode 100755 (executable)
index a48c932..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-use File::Basename;
-use Cwd 'abs_path';
-
-my $REGDIR = abs_path(dirname($0));
-my $RASTERDIR = abs_path($REGDIR . "/../raster/test/regress");
-
-unlink $RASTERDIR . '/' . $TEST . '-pre.sql';
-unlink $RASTERDIR . '/' . $TEST . '-post.sql';
diff --git a/raster/test/regress/rt_bytea-post.sh b/raster/test/regress/rt_bytea-post.sh
deleted file mode 100755 (executable)
index e170758..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-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_bytea-pre.sh b/raster/test/regress/rt_bytea-pre.sh
deleted file mode 100755 (executable)
index 6102ed0..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-FILERASTER="$DIR/loader/testraster.tif"
-
-# special handling for msys
-CSYS=`uname -o | tr '[:upper:]' '[:lower:]'`
-if [ "$CSYS" == "msys" ]; then
-       FILERASTER=`cmd //c echo "${FILERASTER}"`
-fi
-
-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/raster/test/regress/rt_utility-post.pl b/raster/test/regress/rt_utility-post.pl
deleted file mode 100755 (executable)
index a48c932..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-use File::Basename;
-use Cwd 'abs_path';
-
-my $REGDIR = abs_path(dirname($0));
-my $RASTERDIR = abs_path($REGDIR . "/../raster/test/regress");
-
-unlink $RASTERDIR . '/' . $TEST . '-pre.sql';
-unlink $RASTERDIR . '/' . $TEST . '-post.sql';
diff --git a/raster/test/regress/rt_utility-pre.pl b/raster/test/regress/rt_utility-pre.pl
deleted file mode 100755 (executable)
index 772877d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-use File::Basename;
-use Cwd 'abs_path';
-
-my $REGDIR = abs_path(dirname($0));
-my $RASTERDIR = abs_path($REGDIR . "/../raster/test/regress");
-my $FILERASTER = $RASTERDIR . "/loader/testraster.tif";
-
-# special handling for msys
-if (lc($^O) eq "msys") {
-       $FILERASTER = `cmd //c echo "$FILERASTER"`;
-       $FILERASTER =~ s/^\s+//;
-       $FILERASTER =~ s/\s+$//;
-}
-
-my $sql = <<"END";
-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
-END
-
-open(PRESQL, '>', $RASTERDIR . '/' . $TEST . '-pre.sql');
-print PRESQL $sql;
-close(PRESQL);
-
-open(POSTSQL, '>', $RASTERDIR . '/' . $TEST . '-post.sql');
-print POSTSQL "DROP TABLE IF EXISTS raster_outdb_template;\n";
-close(POSTSQL);
index dfcfbaec71c4a5055a75fec46c732c4abfdbf400..38c4877827d5472253b395b6f4b7698744c7c013 100755 (executable)
@@ -1039,21 +1039,21 @@ sub prepare_spatial
        
        if ( $OPT_WITH_TOPO )
        {
-               print "Loading Topology\n";
+               print "Loading Topology into '${DB}'\n";
                load_sql_file("${STAGED_SCRIPTS_DIR}/topology.sql", 1);
                load_sql_file("${STAGED_SCRIPTS_DIR}/topology_comments.sql", 0);
        }
        
        if ( $OPT_WITH_RASTER )
        {
-               print "Loading Raster\n";
+               print "Loading Raster into '${DB}'\n";
                load_sql_file("${STAGED_SCRIPTS_DIR}/rtpostgis.sql", 1);
                load_sql_file("${STAGED_SCRIPTS_DIR}/raster_comments.sql", 0);
        }
 
        if ( $OPT_WITH_SFCGAL )
        {
-               print "Loading sfcgal\n";
+               print "Loading SFCGAL into '${DB}'\n";
                load_sql_file("${STAGED_SCRIPTS_DIR}/sfcgal.sql", 1);
                load_sql_file("${STAGED_SCRIPTS_DIR}/sfcgal_comments.sql", 0);
        }