Commit 4b7c3b7d authored by Bborie Park's avatar Bborie Park

Refactored use of out-db rasters for regression tests

git-svn-id: http://svn.osgeo.org/postgis/trunk@11496 b70326c6-7e19-0410-871a-916f4a2858ee
parent 9e5db410
......@@ -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"
......
SET client_min_messages TO warning;
-- remove raster_outdb_template table
DROP TABLE IF EXISTS raster_outdb_template;
......@@ -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';
......@@ -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"
......@@ -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);
......@@ -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"
SELECT count(*) FROM raster_outdb_template;
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"
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);
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"
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';
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"
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"
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';
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);
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment