[PATCH v1] testwrap: support EXTRA_REGRESS_OPTS environment variable

Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To:
Date: 2026-04-23T05:01:13Z
Lists: pgsql-hackers
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


--3WyonmA85JeTPG5k--