Re: Using LibPq in TAP tests via FFI

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Using LibPq in TAP tests via FFI
Date: 2024-06-16 21:43:05
Message-ID: CAD5tBcLd_2==N2GX7s4BTFQZzTkr4GbGxsei9Uj8sd7wWW37Jw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 14, 2024 at 12:25 PM Andres Freund <andres(at)anarazel(dot)de> wrote:

> Hi,
>
> On 2024-06-14 11:11:38 -0400, Andrew Dunstan wrote:
> > On 2024-06-14 Fr 11:09, Andrew Dunstan wrote:
> > > Over at [1] Andres expressed enthusiasm for enabling TAP tests to call
> > > LibPQ directly via FFI, and there was some support from others as well.
> > > Attached is a very rough POC for just that.There are two perl modules,
> > > one which wraps libpq (or almost all of it) in perl, and another which
> > > uses that module to create a session object that can be used to run
> SQL.
>
> What are your current thoughts about a fallback for this? It seems
> possible
> to implement the session module ontop of BackgroundPsql.pm, if necessary.
> But
> I suspect we'll eventually get to a point where that gets less and less
> convenient.
>

I guess it's a question of how widely available FFI::Platypus is. I know
it's available pretty much out of the box on Strawberry Perl and Msys2'
ucrt perl. It works fine on my Ubuntu ARM64 instance. On my Mac I had to
install it via cpan, but that worked fine. For the moment CYgwin has me
beat, but I believe it's possible to make it work - at least the docs
suggest it is. Not sure about other platforms.

I agree with you that falling back on BackgroundPsql is not a terribly
satisfactory solution.

>
>
> How much of a dependency is FFI::Platypus, compared to requiring perl
> headers
> to be installed? In case FFI::Platypus is a complicted dependency, a
> small XS
> wrapper could be an alternative.
>
>
>

Sure we could look at it. I might need to enlist some assistance there :-).
Using FFI is really nice because it does so much of the work for you.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2024-06-16 22:12:05 Re: Inval reliability, especially for inplace updates
Previous Message Robert Haas 2024-06-16 21:04:41 Re: RFC: adding pytest as a supported test framework