This is a quick follow-up to the extension_control_path patch. With this little additional patch, you can now run "make check" in PGXS-using extensions (instead of having to do make install; make installcheck with a running instance). I think this would be very convenient for extension development.

The patch is still rough, probably needs a bit of work to do proper escaping, quoting, further testing, and it will probably break if you use a different source tree layout. Maybe with a bit of help we can get this robust enough. Or otherwise, it can at least serve as inspiration for what you can implement yourself in your extension's makefile.
From d08218d36d4590f80c2d46f3d7c30bee3e35b7e2 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Thu, 20 Mar 2025 14:00:18 +0100
Subject: [PATCH v0] WIP: Support "make check" for PGXS extensions

---
 src/Makefile.global.in | 3 +++
 src/makefiles/pgxs.mk  | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 8fe9d61e82a..97a7491febb 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -396,6 +396,7 @@ endif
 # In much the same way as above, these rules ensure that we build a temp
 # install tree just once in any recursive "make check".  The additional test
 # on abs_top_builddir prevents doing anything foolish to the root directory.
+ifndef PGXS
 
 check: temp-install
 
@@ -440,6 +441,8 @@ endif
 checkprep:
        $(if $(EXTRA_INSTALL),for extra in $(EXTRA_INSTALL); do $(MAKE) -C 
'$(top_builddir)'/$$extra DESTDIR='$(abs_top_builddir)'/tmp_install install || 
exit; done)
 
+endif  # not PGXS
+
 PROVE = @PROVE@
 # There are common routines in src/test/perl, and some test suites have
 # extra perl modules in their own directory.
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index 0de3737e789..9fe8e1d0cb4 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -446,8 +446,11 @@ endif # NO_INSTALLCHECK
 # Runs independently of any installation
 ifdef PGXS
 check:
-       @echo '"$(MAKE) check" is not supported.'
-       @echo 'Do "$(MAKE) install", then "$(MAKE) installcheck" instead.'
+ifdef REGRESS
+       echo "dynamic_library_path = '\$$libdir:$(CURDIR)'" 
>>$(CURDIR)/temp.conf
+       echo "extension_control_path = '\$$system:$(CURDIR)'" 
>>$(CURDIR)/temp.conf
+       $(pg_regress_check) $(REGRESS_OPTS) $(REGRESS) --temp-config 
$(CURDIR)/temp.conf
+endif
 else
 check: submake $(REGRESS_PREP)
 ifdef REGRESS

base-commit: 618c64ffd3967cb5313b4b11e1e1043a074f2139
-- 
2.49.0

Reply via email to