pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
meson/testwrap: support EXTRA_REGRESS_OPTS environment variable
3+ messages / 2 participants
[nested] [flat]

* meson/testwrap: support EXTRA_REGRESS_OPTS environment variable
@ 2026-04-23 13:05  Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Bertrand Drouvot @ 2026-04-23 13:05 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org

Hi hackers,

While looking at [1], I did use the pg_regress --use-existing flag that way:

TESTS="test_setup create_index memoize --use-existing" meson test -C meson_build --setup running --suite regress-running

and that produced the desired outcome (i.e running those 3 tests from the regress
suite on a running instance and existing regression database).

That was kind of a trick and not surprisingly when I wanted to run the entire
regress suite that way:

TESTS="--use-existing" meson test -C meson_build --setup running --suite regress-running

things did not work as expected and produced:

1/1 regress-running - postgresql:regress-running/regress        SKIP              0.04s

Ok:                0
Fail:              0
Skipped:           1

means it skipped the tests.

OTOH, with autoconf, one could run:

EXTRA_REGRESS_OPTS="--use-existing" make installcheck

and that would work as expected (means running the entire regress suite on an
existing regression database).

So it looks like that currently (unless I missed it), with meson, it is not
possible to run an entire test suite on a running instance and existing regression
database.

Indeed, setting the TESTS environment variable replaces the schedule and test
list entirely. This means that passing only pg_regress flags (e.g.,
TESTS="--use-existing") results in no tests being run, since no schedule or test
names are included.

The attached patch adds support for EXTRA_REGRESS_OPTS in testwrap. When set,
its contents are appended to the test command for regress, isolation, and ecpg
test types, matching autoconf behavior.

This enables running the full schedule with extra pg_regress options, like:

EXTRA_REGRESS_OPTS="--use-existing" meson test --setup running --suite regress-running

Once we agree on a fix and that fix is pushed, I think it would make sense
to add an example in [2].

[1]: https://postgr.es/m/aekGK/SUIeW5n5fY%40bdtpg
[2]: https://wiki.postgresql.org/wiki/Meson

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachments:

  [text/x-diff] v1-0001-testwrap-support-EXTRA_REGRESS_OPTS-environment-v.patch (1.7K, ../../aeoZMJxXLpZgla4P@bdtpg/2-v1-0001-testwrap-support-EXTRA_REGRESS_OPTS-environment-v.patch)
  download | inline diff:
From b79068ec0292dcc623431fa1a5c7cee8668b1170 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Thu, 23 Apr 2026 05:01:13 +0000
Subject: [PATCH v1] testwrap: support EXTRA_REGRESS_OPTS environment variable

With autoconf, EXTRA_REGRESS_OPTS can be used to pass additional flags to
pg_regress, pg_isolation_regress, and pg_regress_ecpg. For example:

EXTRA_REGRESS_OPTS="--use-existing" make installcheck

There was no meson equivalent. The TESTS environment variable could not be
used for this purpose because setting it replaces the schedule entirely,
so passing only flags (e.g., TESTS="--use-existing") resulted in no tests
being run.

Add support for EXTRA_REGRESS_OPTS in testwrap. When set, its contents are
appended to the test command for regress, isolation, and ecpg test types,
matching autoconf behavior.

This enables running the full schedule with extra pg_regress options, like:

EXTRA_REGRESS_OPTS="--use-existing" meson test --setup running --suite regress-running

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
---
 src/tools/testwrap | 3 +++
 1 file changed, 3 insertions(+)
 100.0% src/tools/

diff --git a/src/tools/testwrap b/src/tools/testwrap
index e91296ecd15..8c44f9bc2d6 100755
--- a/src/tools/testwrap
+++ b/src/tools/testwrap
@@ -61,6 +61,9 @@ else:
     if args.tests:
         args.test_command.extend(args.tests)
 
+if "EXTRA_REGRESS_OPTS" in env_dict and args.testname in ('regress', 'isolation', 'ecpg'):
+    args.test_command += env_dict["EXTRA_REGRESS_OPTS"].split()
+
 sp = subprocess.Popen(args.test_command, env=env_dict, stdout=subprocess.PIPE)
 # Meson categorizes a passing TODO test point as bad
 # (https://github.com/mesonbuild/meson/issues/13183).  Remove the TODO
-- 
2.34.1

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: meson/testwrap: support EXTRA_REGRESS_OPTS environment variable
@ 2026-05-01 06:41  Andreas Karlsson <andreas@proxel.se>
  parent: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Andreas Karlsson @ 2026-05-01 06:41 UTC (permalink / raw)
  To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>; pgsql-hackers@lists.postgresql.org

On 4/23/26 15:05, Bertrand Drouvot wrote:
> This enables running the full schedule with extra pg_regress options, like:
> 
> EXTRA_REGRESS_OPTS="--use-existing" meson test --setup running --suite regress-running
> 
> Once we agree on a fix and that fix is pushed, I think it would make sense
> to add an example in [2].
Nice to see more people wanting this. :)

I already have a patch[1] for this in the current commitfest which 
people think looks good other than that it lacks documentation, which I 
think is a fair complaint. It is basically just waiting for me (or 
someone else!) to find a bit of time to write documentation for it. Feel 
free to help out, but otherwise I plan to write documentation after 
PGConf.dev when my life is a bit less hectic.

1. https://commitfest.postgresql.org/patch/6361/

--
Andreas Karlsson
Percona






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: meson/testwrap: support EXTRA_REGRESS_OPTS environment variable
@ 2026-05-04 05:57  Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
  parent: Andreas Karlsson <andreas@proxel.se>
  0 siblings, 0 replies; 3+ messages in thread

From: Bertrand Drouvot @ 2026-05-04 05:57 UTC (permalink / raw)
  To: Andreas Karlsson <andreas@proxel.se>; +Cc: pgsql-hackers@lists.postgresql.org

Hi,

On Fri, May 01, 2026 at 08:41:55AM +0200, Andreas Karlsson wrote:
> On 4/23/26 15:05, Bertrand Drouvot wrote:
> > This enables running the full schedule with extra pg_regress options, like:
> > 
> > EXTRA_REGRESS_OPTS="--use-existing" meson test --setup running --suite regress-running
> > 
> > Once we agree on a fix and that fix is pushed, I think it would make sense
> > to add an example in [2].
> Nice to see more people wanting this. :)
> 
> I already have a patch[1] for this in the current commitfest

Thanks for the reach out, I just withdrawn mine then.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-05-04 05:57 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-23 13:05 meson/testwrap: support EXTRA_REGRESS_OPTS environment variable Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
2026-05-01 06:41 ` Andreas Karlsson <andreas@proxel.se>
2026-05-04 05:57   ` Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox