|
| 1 | +# Makefile for tests of the Citus extension |
| 2 | + |
| 3 | +print-% : ; @echo $* = $($*) |
| 4 | + |
| 5 | +#citus_top_builddir = ../../.. |
| 6 | + |
| 7 | +#include Makefile.global |
| 8 | +cur_dir:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) |
| 9 | + |
| 10 | +citus_abs_srcdir:=${cur_dir} |
| 11 | +citus_abs_top_srcdir:=${cur_dir} |
| 12 | +#postgres_abs_srcdir:=/var/lib/pgsql/rpm10/BUILD/postgresql-10.2 |
| 13 | +#postgres_abs_builddir:=/var/lib/pgsql/rpm10/BUILD/postgresql-10.2 |
| 14 | + |
| 15 | +PG_CONFIG:=pg_config |
| 16 | +PGXS:=$(shell $(PG_CONFIG) --pgxs) |
| 17 | + |
| 18 | +# Citus is built using PostgreSQL's pgxs |
| 19 | +USE_PGXS=1 |
| 20 | +include $(PGXS) |
| 21 | + |
| 22 | +# ensure MAJORVERSION is defined (missing in older versions) |
| 23 | +ifndef MAJORVERSION |
| 24 | +MAJORVERSION := $(basename $(VERSION)) |
| 25 | +endif |
| 26 | + |
| 27 | +## |
| 28 | +## Citus regression support |
| 29 | +## |
| 30 | +MULTI_INSTALLDIR=$(CURDIR)/tmp_check/install |
| 31 | +pg_regress_multi_check = $(PERL) $(citus_abs_srcdir)/pg_regress_multi.pl --pgxsdir="$(pgxsdir)" --bindir="$(bindir)" --libdir="$(libdir)" --majorversion="$(MAJORVERSION)" --postgres-builddir="$(postgres_abs_builddir)" --postgres-srcdir="$(postgres_abs_srcdir)" |
| 32 | +MULTI_REGRESS_OPTS = --inputdir=$(citus_abs_srcdir) $(pg_regress_locale_flags) |
| 33 | + |
| 34 | +# XXX: Can't actually do useful testruns against install - $libdir |
| 35 | +# etc will point to the directory configured during postgres' |
| 36 | +# build. We could copy the installed tree around, but that's quite |
| 37 | +# likely to be mixed with other binaries and such... |
| 38 | +cleandir-main: |
| 39 | +### echo rm -rf '$(CURDIR)'/tmp_check/install |
| 40 | +### |
| 41 | +tempinstall-main: cleandir-main |
| 42 | +#### mkdir -p $(MULTI_INSTALLDIR) |
| 43 | +### $(MAKE) DESTDIR=$(MULTI_INSTALLDIR) -C $(citus_top_builddir) install > tmp_check/install.log 2>&1 |
| 44 | + |
| 45 | +# Test input and expected files. These are created by pg_regress itself, so we |
| 46 | +# don't have a rule to create them. We do need rules to clean them however. |
| 47 | +input_files := $(patsubst $(citus_abs_srcdir)/input/%.source,sql/%.sql, $(wildcard $(citus_abs_srcdir)/input/*.source)) |
| 48 | +output_files := $(patsubst $(citus_abs_srcdir)/output/%.source,expected/%.out, $(wildcard $(citus_abs_srcdir)/output/*.source)) |
| 49 | + |
| 50 | +# have make check actually run all tests, but keep check-full as an |
| 51 | +# intermediate, for muscle memory backward compatibility. |
| 52 | +check: all tempinstall-main |
| 53 | + $(pg_regress_multi_check) --load-extension=citus \ |
| 54 | + -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/shard_migration $(EXTRA_TESTS) |
| 55 | + |
| 56 | +check_base: all tempinstall-main |
| 57 | + $(pg_regress_multi_check) --load-extension=citus \ |
| 58 | + -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/check_base $(EXTRA_TESTS) |
| 59 | + |
| 60 | +clean distclean maintainer-clean: |
| 61 | + rm -f $(output_files) $(input_files) |
| 62 | + rm -rf tmp_check/ |
| 63 | + |
0 commit comments