OSDN Git Service

Allow run make check of PostgreSQL with loading pg_hint.plan
authorKyotaro Horiguchi <horikyota.ntt@gmail.com>
Wed, 6 Oct 2021 02:51:44 +0000 (11:51 +0900)
committerKyotaro Horiguchi <horikyota.ntt@gmail.com>
Wed, 6 Oct 2021 02:57:29 +0000 (11:57 +0900)
Automatically switch environment when pg_hint_plan is installed as a
part of "make check" of PostgreSQL.  That test is executed with the
following command line in the top directory of PostgreSQL tree.

make check EXTRA_INSTALL=<this directory> EXTRA_REGRESS_OPTS="--temp-config <this directory>/pg_hint_plan.conf"

make check-world fails for test that requires extra modules.

Makefile

index 1a8ae90..8b6ec2d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,9 +18,21 @@ DATA = pg_hint_plan--*.sql
 
 EXTRA_CLEAN = sql/ut-fdw.sql expected/ut-fdw.out RPMS
 
+# Switch environment between standalone make and make check with
+# EXTRA_INSTALL from PostgreSQL tree
+# run the following command in the PG tree to run a regression test
+# loading this module.
+# $ make check EXTRA_INSTALL=<this directory> EXTRA_REGRESS_OPTS="--temp-config <this directory>/pg_hint_plan.conf"
+ifeq ($(wildcard $(DESTDIR)/../src/Makefile.global),)
 PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
 include $(PGXS)
+else
+subdir = `pwd`
+top_builddir = $(DESTDIR)/..
+include $(DESTDIR)/../src/Makefile.global
+include $(DESTDIR)/../contrib/contrib-global.mk
+endif
 
 STARBALL14 = pg_hint_plan14-$(HINTPLANVER).tar.gz
 STARBALLS = $(STARBALL14)