[bugfix]"make installcheck" could not work in PGXS

From: "matsumura(dot)ryo(at)fujitsu(dot)com" <matsumura(dot)ryo(at)fujitsu(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [bugfix]"make installcheck" could not work in PGXS
Date: 2020-07-31 08:31:56
Message-ID: OSAPR01MB5027815EB35221EC576976D5E84E0@OSAPR01MB5027.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I found that "make installcheck" could not work in PGXS.

--[/src/foo_project/Makefile]--
SUBDIRS = foo

TAP_TESTS = 1

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)

include $(PGXS)

$(recurse)
$(recurse_always)

--[/src/foo_project/t/001_foo_test.pl]
use strict;
use warnings;
use PostgresNode;
use TestLib;

# Replace with the number of tests to execute:
use Test::More tests => 1;

my $node = PostgresNode->get_new_node('primary');
$node->init; ## --> Bailout called in PostgresNode.pm that refers PG_REGRESS environment variable.

--[log]--
cd /src/foo_project
make installcheck
:
:
rm -rf '/src/foo_project'/tmp_check
/bin/mkdir -p '/src/foo_project'/tmp_check
cd ./ && TESTDIR='/src/foo_project' PATH="/installdir/bin:$PATH" PGPORT='65432' top_builddir='/src/foo_project//installdir/lib/pgxs/src/makefiles/../..' PG_REGRESS='/src/foo_project//installdir/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress' REGRESS_SHLIB='/src/test/regress/regress.so' /bin/prove -I /installdir/lib/pgxs/src/makefiles/../../src/test/perl/ -I ./ t/*.pl
t/001_foo_test.pl .... Bailout called. Further testing stopped: system /src/foo_project//installdir/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress failed
FAILED--Further testing stopped: system /src/foo_project//installdir/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress failed
make: *** [installcheck] Error 255

The cause is in [Makefile.global.in].
Althogh $(CURDIR) is '/src/foo_project' and $(top_builddir) is '/installdir/lib/pgxs',
the code concatenates them for setting PG_REGRESS.

``
define 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='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' REGRESS_SHLIB='$(abs_top_builddir)/src/test/regress/regress$(DLSUFFIX)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
endef
``

In non-PGXS environment, top_builddir is a relative path against the top of postgresql source tree.
But, in PGXS, top_builddir is a absolute path like /installdir/lib/pgxs/src/makefiles intentionally.
The existing code of [Makefile.global.in] does not consider it.

I make a patch. (It may not to be smart.)
Please your comments.

Regards
Ryo Matsumura

Attachment Content-Type Size
bug_pgxs_installcheck.v1.patch application/octet-stream 802 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-07-31 08:32:13 Re: fixing pg_ctl with relative paths
Previous Message torikoshia 2020-07-31 08:24:44 Re: Creating a function for exposing memory usage of backend process