Run tap tests in src/interfaces/libpq.
authorAndres Freund <andres@anarazel.de>
Sun, 27 Feb 2022 00:51:47 +0000 (16:51 -0800)
committerAndres Freund <andres@anarazel.de>
Sun, 27 Feb 2022 00:51:47 +0000 (16:51 -0800)
To be able to run binaries in the test/ directory, prove_[install]check need
to be executable in a single shell invocation, so that test/ can be added to
PATH.

Discussion: https://postgr.es/m/20220223203031.ezrd73ohvjgfksow@alap3.anarazel.de

src/Makefile.global.in
src/interfaces/libpq/.gitignore
src/interfaces/libpq/Makefile

index c980444233f0d96d6f8b63c81a59b322f66e0b1a..bbdc1c4bda60349bb7333e4d7ae614a990dc52f9 100644 (file)
@@ -448,8 +448,8 @@ ifeq ($(enable_tap_tests),yes)
 
 ifndef PGXS
 define prove_installcheck
-rm -rf '$(CURDIR)'/tmp_check
-$(MKDIR_P) '$(CURDIR)'/tmp_check
+rm -rf '$(CURDIR)'/tmp_check && \
+$(MKDIR_P) '$(CURDIR)'/tmp_check && \
 cd $(srcdir) && \
    TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \
    PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \
@@ -458,8 +458,8 @@ cd $(srcdir) && \
 endef
 else # PGXS case
 define prove_installcheck
-rm -rf '$(CURDIR)'/tmp_check
-$(MKDIR_P) '$(CURDIR)'/tmp_check
+rm -rf '$(CURDIR)'/tmp_check && \
+$(MKDIR_P) '$(CURDIR)'/tmp_check && \
 cd $(srcdir) && \
    TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \
    PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \
@@ -469,8 +469,8 @@ endef
 endif # PGXS
 
 define prove_check
-rm -rf '$(CURDIR)'/tmp_check
-$(MKDIR_P) '$(CURDIR)'/tmp_check
+rm -rf '$(CURDIR)'/tmp_check && \
+$(MKDIR_P) '$(CURDIR)'/tmp_check && \
 cd $(srcdir) && \
    TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \
    PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
index 7478dc344ac346a08bb0cc3059eba28cd1400287..829d683ed27d4607b8969dc03d9bc08bcc5c20c2 100644 (file)
@@ -1,2 +1,3 @@
 /exports.list
 /libpq-refs-stamp
+/tmp_check/
index 844c95d47de694ab0efe02c12d090d48c221c227..3c53393fa4102dac12e54b144568d2becae98ad8 100644 (file)
@@ -137,8 +137,14 @@ install: all installdirs install-lib
    $(INSTALL_DATA) $(srcdir)/pqexpbuffer.h '$(DESTDIR)$(includedir_internal)'
    $(INSTALL_DATA) $(srcdir)/pg_service.conf.sample '$(DESTDIR)$(datadir)/pg_service.conf.sample'
 
-installcheck:
-   $(MAKE) -C test $@
+test-build:
+   $(MAKE) -C test all
+
+check: test-build all
+   PATH="$(CURDIR)/test:$$PATH" && $(prove_check)
+
+installcheck: test-build all
+   PATH="$(CURDIR)/test:$$PATH" && $(prove_installcheck)
 
 installdirs: installdirs-lib
    $(MKDIR_P) '$(DESTDIR)$(includedir)' '$(DESTDIR)$(includedir_internal)' '$(DESTDIR)$(datadir)'
@@ -153,6 +159,7 @@ uninstall: uninstall-lib
 
 clean distclean: clean-lib
    $(MAKE) -C test $@
+   rm -rf tmp_check
    rm -f $(OBJS) pthread.h libpq-refs-stamp
 # Might be left over from a Win32 client-only build
    rm -f pg_config_paths.h