Re: Using LibPq in TAP tests via FFI - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Using LibPq in TAP tests via FFI
Date
Msg-id CAD5tBcLd_2==N2GX7s4BTFQZzTkr4GbGxsei9Uj8sd7wWW37Jw@mail.gmail.com
Whole thread Raw
In response to Re: Using LibPq in TAP tests via FFI  (Andres Freund <andres@anarazel.de>)
Responses Re: Using LibPq in TAP tests via FFI
List pgsql-hackers


On Fri, Jun 14, 2024 at 12:25 PM Andres Freund <andres@anarazel.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
 

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: RFC: adding pytest as a supported test framework
Next
From: Noah Misch
Date:
Subject: Re: Inval reliability, especially for inplace updates