Re: ssl tests aren't concurrency safe due to get_free_port()

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: ssl tests aren't concurrency safe due to get_free_port()
Date: 2023-04-25 10:27:52
Message-ID: 78d1cfa6-0065-865d-584b-cde6d8c18aff@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20.11.22 16:10, Andrew Dunstan wrote:
>
> On 2022-11-19 Sa 15:16, Andres Freund wrote:
>> Hi,
>>
>> On 2022-11-19 10:56:33 -0500, Andrew Dunstan wrote:
>>>> Perhaps we should just export a directory in configure instead of this
>>>> guessing game?
>>> I think the obvious candidate would be to export top_builddir from
>>> src/Makefile.global. That would remove the need to infer it from
>>> TESTDATADIR.
>> I think that'd be good. I'd perhaps rename it in the process so it's
>> exported uppercase, but whatever...
>>
>
> OK, pushed with a little more tweaking. I didn't upcase top_builddir
> because the existing prove_installcheck recipes already export it and I
> wanted to stay consistent with those.
>
> If it works ok I will backpatch in couple of days.

These patches have affected pgxs-using extensions that have their own
TAP tests.

The portlock directory is created at

my $build_dir = $ENV{top_builddir}
|| $PostgreSQL::Test::Utils::tmp_check ;
$portdir ||= "$build_dir/portlock";

but for a pgxs user, top_builddir points into the installation tree,
specifically at $prefix/lib/pgxs/.

So when running "make installcheck" for an extension, we either won't
have write access to that directory, or if we do, then it's still not
good to write into the installation tree during a test suite.

A possible fix is

diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 5dacc4d838..c493d1a60c 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -464,7 +464,7 @@ 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)' \
+ PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)' \
PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if
$(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
endef

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Cramer 2023-04-25 11:26:18 Re: Request for comment on setting binary format output per session
Previous Message Richard Guo 2023-04-25 10:06:01 Re: postgres_fdw: wrong results with self join + enable_nestloop off