From e3dba3f6ca30bcf1438dc11978975df5909b02ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jorge=20Ar=C3=A9valo?= Date: Fri, 1 Apr 2011 05:18:45 +0000 Subject: [PATCH] Raster testing added to core testing. Related ticket #762. git-svn-id: http://svn.osgeo.org/postgis/trunk@6994 b70326c6-7e19-0410-871a-916f4a2858ee --- GNUmakefile.in | 2 +- configure.ac | 7 +++-- raster/Makefile.in | 26 ++--------------- raster/rt_pg/Makefile.in | 9 ++++++ raster/test/Makefile.in | 4 +-- raster/test/core/testapi.c | 2 -- raster/test/regress/Makefile.in | 51 ++++++++++++++++++++++++++------- regress/run_test | 2 +- 8 files changed, 61 insertions(+), 42 deletions(-) diff --git a/GNUmakefile.in b/GNUmakefile.in index f87d9c0bc..6000b955e 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -5,7 +5,7 @@ #----------------------------------------------------- # todo: add all subdirs -SUBDIRS = liblwgeom regress postgis loader utils raster @TOPOLOGY@ +SUBDIRS = liblwgeom regress postgis loader utils @RASTER@ @TOPOLOGY@ # todo: add more rules here, like uninstall, clean... all install uninstall noop clean distclean check: diff --git a/configure.ac b/configure.ac index a5f767b47..197d747bd 100644 --- a/configure.ac +++ b/configure.ac @@ -730,9 +730,9 @@ dnl ==================================== AC_ARG_WITH([raster], [AS_HELP_STRING([--with-raster], [compile the raster extension (requires GDAL >= 1.6.0) @<:@default=no@:>@])], - [RASTER="yes"], [RASTER="no"]) + [RASTER="raster"], [RASTER=""]) -if test "x$RASTER" = "xyes"; then +if test "x$RASTER" = "xraster"; then AC_MSG_RESULT([RASTER: Raster support requested]) AC_CONFIG_HEADERS([raster/raster_config.h]) @@ -884,6 +884,9 @@ except ImportError: dnl Activates raster stuff construction. BUILD_RASTER=yes + dnl just in case... + AC_SUBST([RASTER]) + AC_SUBST([RT_CORE_LIB]) AC_SUBST([RT_PG_LIB]) AC_SUBST([RT_POSTGIS_SQL]) diff --git a/raster/Makefile.in b/raster/Makefile.in index 7eb0367db..dd2d36555 100644 --- a/raster/Makefile.in +++ b/raster/Makefile.in @@ -10,60 +10,38 @@ # ############################################################################# -BUILD_RASTER=@BUILD_RASTER@ all: @RT_CORE_LIB@ @RT_PG_LIB@ @RT_POSTGIS_SQL@ corelib: -ifeq ($(BUILD_RASTER), yes) $(MAKE) -C rt_core -endif pglib: -ifeq ($(BUILD_RASTER), yes) $(MAKE) -C rt_pg -endif rtpostgis.sql: -ifeq ($(BUILD_RASTER), yes) $(MAKE) -C rt_pg rtpostgis.sql -endif install: all -ifeq ($(BUILD_RASTER), yes) $(MAKE) -C rt_pg install $(MAKE) -C scripts/python install -endif uninstall: -ifeq ($(BUILD_RASTER), yes) $(MAKE) -C rt_pg uninstall $(MAKE) -C scripts/python uninstall -endif clean: -ifeq ($(BUILD_RASTER), yes) $(MAKE) -C rt_core $@ $(MAKE) -C rt_pg $@ $(MAKE) -C test $@ $(MAKE) -C scripts/python $@ -endif distclean: clean -ifeq ($(BUILD_RASTER), yes) $(RM) -R autom4te.cache $(RM) config.status -endif -check: -ifeq ($(BUILD_RASTER), yes) +core-check: $(MAKE) -C test $@ - @echo - @echo "Consider also running make post-install-check after installation" - @echo -endif -post-install-check: -ifeq ($(BUILD_RASTER), yes) +check: core-check $(MAKE) -C test $@ -endif diff --git a/raster/rt_pg/Makefile.in b/raster/rt_pg/Makefile.in index 736ddf2c3..a95c4bc2e 100644 --- a/raster/rt_pg/Makefile.in +++ b/raster/rt_pg/Makefile.in @@ -57,6 +57,15 @@ ifeq ($(PGXSOVERRIDE),1) include Makefile.pgxs endif +# If REGRESS=1 passed as a parameter, change the default install paths +# so that no prefix is included. This allows us to relocate to a temporary +# directory for regression testing. +ifeq ($(REGRESS),1) + bindir=/bin + pkglibdir=/lib + datadir=/share +endif + # Borrow the $libdir substitution from PGXS but customise by adding the version number %.sql: %.sql.in sed 's,MODULE_PATHNAME,$$libdir/rtpostgis-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@,g' $< >$@ diff --git a/raster/test/Makefile.in b/raster/test/Makefile.in index 18380619b..733517644 100644 --- a/raster/test/Makefile.in +++ b/raster/test/Makefile.in @@ -12,10 +12,10 @@ RT_CORE=../rt_core all: check -check: $(RT_CORE)/librtcore.a +core-check: $(RT_CORE)/librtcore.a $(MAKE) -C core check -post-install-check: $(RT_CORE)/librtcore.a +check: core-check $(MAKE) -C regress check $(RT_CORE)/librtcore.a: diff --git a/raster/test/core/testapi.c b/raster/test/core/testapi.c index b356a946d..ffedd3e3f 100644 --- a/raster/test/core/testapi.c +++ b/raster/test/core/testapi.c @@ -1116,8 +1116,6 @@ main() /* First test: NODATA value = -1 */ rt_raster rt = fillRasterToPolygonize(ctx, 1, -1.0); - - printf("*** POLYGONIZE WITH NODATA = -1.0\n"); /* We can check rt_raster_has_no_band here too */ CHECK(!rt_raster_has_no_band(ctx, rt, 1)); diff --git a/raster/test/regress/Makefile.in b/raster/test/regress/Makefile.in index afabbe12e..442a32a86 100644 --- a/raster/test/regress/Makefile.in +++ b/raster/test/regress/Makefile.in @@ -2,6 +2,7 @@ # $Id$ # # Copyright (c) 2009 Sandro Santilli , Pierre Racine +# Copyright (c) 2011 Jorge Arevalo # # This is free software; you can redistribute and/or modify it under # the terms of the GNU General Public Licence. See the COPYING file. @@ -10,6 +11,21 @@ POSTGIS_SRC=@POSTGIS_SRCDIR@ +# MingW hack: rather than use PGSQL_BINDIR directly, we change +# to the directory and then use "pwd" to return the path. This +# ensures that the returned path is in MSYS format, otherwise +# colons in drive letters will break PATH. +PGSQL_BINDIR=$(shell cd "@PGSQL_BINDIR@" && pwd) + +# Where we put our regression installation +REGRESS_INSTALLDIR=$(POSTGIS_SRC)/regress/00-regress-install + +# +# Put path from pg_config into front of search path +# +PATH := $(PGSQL_BINDIR):$(PATH) +export PATH + TEST_METADATA = \ check_raster_columns.sql \ check_raster_overviews.sql \ @@ -53,8 +69,8 @@ TEST_PIXEL = \ TEST_UTILITY = \ create_rt_utility_test.sql \ rt_utility.sql \ - create_rt_mapalgebra_test.sql \ - rt_mapalgebra.sql \ + create_rt_mapalgebra_test.sql \ + rt_mapalgebra.sql \ $(NULL) TEST_GIST = \ @@ -85,14 +101,29 @@ TESTS = $(TEST_METADATA) $(TEST_IO) $(TEST_FUNC) \ $(TEST_UTILITY) $(TEST_GIST) $(TEST_SREL) \ $(TEST_BUGS) -all: run_test +all: + @echo "Use 'make check' to run all tests" + +clean distclean: + $(RM) -f rtpostgis.sql + +rtpostgis.sql: ../../rt_pg/rtpostgis.sql + sed 's,$$libdir,$(REGRESS_INSTALLDIR)/lib,g' ../../rt_pg/rtpostgis.sql > rtpostgis.sql + + +check: rtpostgis.sql + $(MAKE) -C ../../../regress postgis.sql staged-install + $(MAKE) -C ../../rt_pg REGRESS=1 DESTDIR=$(REGRESS_INSTALLDIR) install + @USE_VERSION=$(POSTGIS_PGSQL_VERSION) ../../../regress/run_test --raster $(TESTS) + +#all: run_test -run_test: run_test.in Makefile - sed -e "s#@POSTGIS_SRC@#$(POSTGIS_SRC)#" $< > $@ - chmod +x $@ +#run_test: run_test.in Makefile +# sed -e "s#@POSTGIS_SRC@#$(POSTGIS_SRC)#" $< > $@ +# chmod +x $@ -post-install-check check: run_test - ./run_test $(TESTS) +#post-install-check check: run_test +# ./run_test $(TESTS) -clean: - $(RM) run_test +#clean: +# $(RM) run_test diff --git a/regress/run_test b/regress/run_test index 6477418d0..b03885e78 100755 --- a/regress/run_test +++ b/regress/run_test @@ -462,7 +462,7 @@ if test -z "$db_exists"; then fi if test x"$OPT_WITH_RASTER" = "xyes"; then if test -e ${REGDIR}/../raster/rt_pg/rtpostgis.sql; then - echo "Adding topology support" + echo "Adding raster support" ${PSQL} ${_psql_opts} -Xf ${REGDIR}/../raster/rt_pg/rtpostgis.sql "${DB}" >> ${TMPDIR}/regress_log 2>&1 else echo "Raster support skipped (rtpostgis.sql not found)" -- 2.50.1