From 9cd66b28ec9c93386ac87c9f36c67a0bde4e6b10 Mon Sep 17 00:00:00 2001 From: Craig Ringer Date: Thu, 23 Apr 2020 12:25:55 +0800 Subject: [PATCH 2/4] Move installed pg_regress test sources to $(pkglibdir)/pgxs/src/test/regress $(pkglibdir)/pgxs/ corresponds to the top_srcdir in a real source tree. It's supposed to be a thinned out top_srcdir that extensions etc can treat as if it's a real PostgreSQL srcdir when building and testing. When support for installing the pg_regress test sources themselves was added so we could create postgresqlNN-test packages, the test sources were installed in $(pkglibdir)/regress, outside the virtual srcdir. That's OK, it just means they aren't where you'd really expect them to be and cannot be found by Makefiles. Relocate the installed location to $(pkglibdir)/pgxs/src/test/regress so that they're in the same place relative to the installdir's fake $(top_srcdir) as they are in the real srcdir. Many packages already move them elsewhere; e.g. PGDG rpms install them in $(pkglibdir)/test/regress/ . So there is not a single expected location right now. Additionally we don't install a Makefile that "knows" where they are at present. So this change will mainly affect packaging. Doesn't install src/test/regress/GNUmakefile. It's easy enough to concoct your own pg_regress commandline to run the tests. --- src/test/regress/GNUmakefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 2100850528..312e0f0baf 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -85,14 +85,25 @@ regress_data_files = \ $(wildcard $(srcdir)/data/*.data) \ $(srcdir)/parallel_schedule $(srcdir)/serial_schedule $(srcdir)/resultmap +# Install the sql, expected and data files, schedules, refint and autoinc +# contribs etc we actually need to run a "make installcheck" against an +# installed/packaged postgresql. +# +# Useful for extensions that want to run the Pg regression test suite with +# custom options to check that they don't break anything in PostgreSQL proper. +# +# Tests are installed in the PGXS tree so that they can be found at the +# expected relative paths in PGXS's faked-up thin source tree. +# install-tests: all install install-lib installdirs-tests $(MAKE) -C $(top_builddir)/contrib/spi install $(foreach datafile,$(regress_data_files), \ - $(INSTALL_DATA) $(datafile) '$(DESTDIR)$(pkglibdir)/regress/$(subst $(srcdir),,$(datafile))'; \ + $(INSTALL_DATA) $(datafile) '$(DESTDIR)$(pgxsdir)/$(subdir)/$(subst $(srcdir),,$(datafile))'; \ ) + installdirs-tests: installdirs - $(MKDIR_P) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files)))) + $(MKDIR_P) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pgxsdir)/$(subdir)/%',$(sort $(dir $(regress_data_files)))) # Get some extra C modules from contrib/spi -- 2.25.1