diff --git a/.gitignore b/.gitignore index 7e82c4a..bffb51b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Global excludes across all subdirectories *.o *.so -bin/regression.diffs -bin/regression.out +regress/regression.diffs +regress/regression.out diff --git a/Makefile b/Makefile index a10744e..1d6c5c0 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ $(error pg_repack requires PostgreSQL 8.3 or later. This is $(VERSION)) endif -SUBDIRS = bin lib +SUBDIRS = bin lib regress all install installdirs uninstall distprep clean distclean maintainer-clean debug: @for dir in $(SUBDIRS); do \ diff --git a/bin/Makefile b/bin/Makefile index c7226c8..8d1e733 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -8,38 +8,11 @@ PG_CONFIG ?= pg_config -# version as a number, e.g. 9.1.4 -> 901 -VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}') -INTVERSION := $(shell echo $$(($$(echo $(VERSION) | sed -E 's/([0-9]+)\.([0-9]+).*/\1*100+\2/')))) - SRCS = pg_repack.c pgut/pgut.c pgut/pgut-fe.c OBJS = $(SRCS:.c=.o) PROGRAM = pg_repack -# -# Test suite -# - -ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1) -REGRESS := init-extension -else -REGRESS := init-legacy -endif - -# plpgsql not available by default on pg < 9.0 -ifeq ($(shell echo $$(($(INTVERSION) < 900))),1) -REGRESS += plpgsql -endif - -REGRESS += repack tablespace - -# This test depends on collate, not supported before 9.1 -ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1) -REGRESS += issue3 -endif - - # The version number of the program. It should be the same of the library. REPACK_VERSION = $(shell grep '"version":' ../META.json | head -1 \ | sed -e 's/[ ]*"version":[ ]*"\(.*\)",/\1/') diff --git a/regress/Makefile b/regress/Makefile new file mode 100644 index 0000000..ece4b5c --- /dev/null +++ b/regress/Makefile @@ -0,0 +1,42 @@ +# +# pg_repack: regress/Makefile +# +# Portions Copyright (c) 2008-2012, NIPPON TELEGRAPH AND TELEPHONE CORPORATION +# Portions Copyright (c) 2011, Itagaki Takahiro +# Portions Copyright (c) 2012, The Reorg Development Team +# + +PG_CONFIG ?= pg_config + +# version as a number, e.g. 9.1.4 -> 901 +VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}') +INTVERSION := $(shell echo $$(($$(echo $(VERSION) | sed -E 's/([0-9]+)\.([0-9]+).*/\1*100+\2/')))) + + +# +# Test suite +# + +ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1) +REGRESS := init-extension +else +REGRESS := init-legacy +endif + +# plpgsql not available by default on pg < 9.0 +ifeq ($(shell echo $$(($(INTVERSION) < 900))),1) +REGRESS += plpgsql +endif + +REGRESS += repack tablespace + +# This test depends on collate, not supported before 9.1 +ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1) +REGRESS += issue3 +endif + + +USE_PGXS = 1 # use pgxs if not in contrib directory +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) +include $(PGXS) diff --git a/bin/expected/init-extension.out b/regress/expected/init-extension.out similarity index 100% rename from bin/expected/init-extension.out rename to regress/expected/init-extension.out diff --git a/bin/expected/init-legacy.out b/regress/expected/init-legacy.out similarity index 100% rename from bin/expected/init-legacy.out rename to regress/expected/init-legacy.out diff --git a/bin/expected/issue3.out b/regress/expected/issue3.out similarity index 100% rename from bin/expected/issue3.out rename to regress/expected/issue3.out diff --git a/bin/expected/plpgsql.out b/regress/expected/plpgsql.out similarity index 100% rename from bin/expected/plpgsql.out rename to regress/expected/plpgsql.out diff --git a/bin/expected/repack.out b/regress/expected/repack.out similarity index 100% rename from bin/expected/repack.out rename to regress/expected/repack.out diff --git a/bin/expected/tablespace.out b/regress/expected/tablespace.out similarity index 100% rename from bin/expected/tablespace.out rename to regress/expected/tablespace.out diff --git a/bin/sql/init-extension.sql b/regress/sql/init-extension.sql similarity index 100% rename from bin/sql/init-extension.sql rename to regress/sql/init-extension.sql diff --git a/bin/sql/init-legacy.sql b/regress/sql/init-legacy.sql similarity index 100% rename from bin/sql/init-legacy.sql rename to regress/sql/init-legacy.sql diff --git a/bin/sql/issue3.sql b/regress/sql/issue3.sql similarity index 100% rename from bin/sql/issue3.sql rename to regress/sql/issue3.sql diff --git a/bin/sql/plpgsql.sql b/regress/sql/plpgsql.sql similarity index 100% rename from bin/sql/plpgsql.sql rename to regress/sql/plpgsql.sql diff --git a/bin/sql/repack.sql b/regress/sql/repack.sql similarity index 100% rename from bin/sql/repack.sql rename to regress/sql/repack.sql diff --git a/bin/sql/tablespace.sql b/regress/sql/tablespace.sql similarity index 100% rename from bin/sql/tablespace.sql rename to regress/sql/tablespace.sql