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: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Using LibPq in TAP tests via FFI
Date: 2024-06-16 14:58:33
Message-ID: CAD5tBcKwpcXYGbgewQDi8LzdrEZ6td-kVwHDRiirsK2M_wQSXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 14, 2024 at 11:40 AM Andres Freund <andres(at)anarazel(dot)de> wrote:

> Hi,
>
> On June 14, 2024 8:09:43 AM PDT, Andrew Dunstan <andrew(at)dunslane(dot)net>
> 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. Also in
> the patch is a modification of one TAP test (arbitrarily chosen as
> src/bin/pg_amcheck/t/004_verify_heapam.p) to use the new interface, so it
> doesn't use psql at all.
> >
> >There's a bunch of work to do here, but for a morning's work it's not too
> bad :-) Luckily I had most of the first file already to hand.
>
> Yay!
>
>
> >Next I plan to look at some of the recovery tests and other uses of
> background_psql, which might be more challenging,a dn require extension of
> the session API. Also there's a lot of error checking and documentation
> that need to be added.
>
> I'd suggest trying to convert the various looping constructs first,
> they're responsible for a large number of spawned shells. And I vaguely
> recall that there were none/very few that depend on actually being run via
> psql.
>
>
>
>
Yeah, here's a new version with a few more scripts modified, and also
poll_query_until() adjusted. That seems to be the biggest looping construct.

The biggest remaining unadjusted script users of psql are all in the
subscription and recovery tests.

cheers

andrew

Attachment Content-Type Size
pqffi-poc-2.patch text/x-patch 31.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2024-06-16 14:59:49 Re: Using LibPq in TAP tests via FFI
Previous Message Marcos Pegoraro 2024-06-16 14:42:51 Re: proposal: plpgsql, new check for extra_errors - strict_expr_check