Hello,
On 21.11.2018 03:39, Michael Paquier wrote:
I have added a reference to regress-tap in one of the new paragraphs.
Linking the existing stuff to point to "regress" is a separate issue
though, and while pointing to the TAP section is adapted as its
guidelines are rather general, I am not sure which one would make the
most sense though.
--
Michael
The patch is very useful. Using TAP_TESTS is more convenient and clearer
than adding wal-check target. Every time I was adding TAP tests for a
extension I had to remember that I should add wal-check.
After applying the patch all tests pass, there wasn't any error.
Also I tested it in one of our extension which has TAP tests.
installcheck and check work as expected.
I think the patch can be marked as "Ready for Committer".
But there is a problem that you need to copy your extension to the
contrib directory if you want to run TAP tests. I tried to run TAP test
of the extension outside of PostgreSQL source directory. And it failed
to run the test. It is because `prove_installcheck` redefines
`top_builddir` and `PG_REGRESS`:
cd ./ && TESTDIR='/home/artur/source/pg/rum'
PATH="/home/artur/progs/pgsql/bin:$PATH" PGPORT='65432'
top_builddir='/home/artur/source/pg/rum//home/artur/progs/pgsql/lib/pgxs/src/makefiles/../..'
PG_REGRESS='/home/artur/source/pg/rum//home/artur/progs/pgsql/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress'
/usr/sbin/prove -I
/home/artur/progs/pgsql/lib/pgxs/src/makefiles/../../src/test/perl/ -I
./ t/*.pl
t/001_wal.pl .. Bailout called. Further testing stopped: system
/home/artur/source/pg/rum//home/artur/progs/pgsql/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress
failed
Unfortunately I didn't find the way to run it, maybe I miss something.
It can be fixed by an additional patch I attached. I think I can create
an entry in the future commitfest or it can be joined into your patch.
--
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index 249061541e..c096f82d60 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -90,6 +90,9 @@ endif
ifeq ($(FLEX),)
FLEX = flex
endif
+ifeq ($(PROVE),)
+PROVE = prove
+endif
endif # PGXS
@@ -405,6 +408,12 @@ ifdef ISOLATION
endif
endif # PGXS
+# There are common routines in src/test/perl, and some test suites have
+# extra perl modules in their own directory.
+PG_PROVE_FLAGS = -I $(top_srcdir)/src/test/perl/ -I $(srcdir)
+# User-supplied prove flags such as --verbose can be provided in PROVE_FLAGS.
+PROVE_FLAGS =
+
# Standard rules to run regression tests including multiple test suites.
# Runs against an installed postmaster
ifndef NO_INSTALLCHECK
@@ -416,7 +425,9 @@ ifdef ISOLATION
$(pg_isolation_regress_installcheck) $(ISOLATION_OPTS) $(ISOLATION)
endif
ifdef TAP_TESTS
- $(prove_installcheck)
+ rm -rf '$(CURDIR)'/tmp_check
+ $(MKDIR_P) '$(CURDIR)'/tmp_check
+ cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
endif
endif # NO_INSTALLCHECK
@@ -434,7 +445,9 @@ ifdef ISOLATION
$(pg_isolation_regress_check) $(ISOLATION_OPTS) $(ISOLATION)
endif
ifdef TAP_TESTS
- $(prove_check)
+ rm -rf '$(CURDIR)'/tmp_check
+ $(MKDIR_P) '$(CURDIR)'/tmp_check
+ cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
endif
endif # PGXS