public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andreas Karlsson <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Add support for EXTRA_REGRESS_OPTS for meson
Date: Thu, 27 Feb 2025 13:53:17 +0100
Message-ID: <[email protected]> (raw)

Hi,

We use EXTRA_REGRESS_OPTS to make sure the whole test suite passes with 
our extension loaded and since I prefer develop in meson over using 
autotools and make the lack of support for EXTRA_REGRESS_OPTS in meson
has bugged me for a while.

I have implemented support for it as an environment variable we read in 
the testwrap script instead of adding it as a configuration option to 
meson.build. The reason for this is that I do not like having to run 
"meson reconfigure" all the time plus that for the PG_TEST_EXTRA we 
ended up having to add an environment variable anyway.

To use this run e.g. the following:

   EXTRA_REGRESS_OPTS="--load-extension=pgcrypto" meson test

Question: Would it make sense to rename it to PG_REGRESS_EXTRA_OPTS or 
something similar while we already touch touch this code to make the 
various options easier to remember?

Andreas


Attachments:

  [text/x-patch] 0001-meson-Add-support-for-EXTRA_REGRESS_OPTS.patch (1.6K, 2-0001-meson-Add-support-for-EXTRA_REGRESS_OPTS.patch)
  download | inline diff:
From 87ce622a19315b679bbd5691e01c96261bc0c4c8 Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <[email protected]>
Date: Thu, 27 Feb 2025 00:23:44 +0100
Subject: [PATCH] meson: Add support for EXTRA_REGRESS_OPTS

Add support for the EXTRA_REGRESS_OPTS environment variable in meson
which works just like with make and applies to all regress, ecpg and
isolation tests. TAP tests which support it under make will continue
to support the option.

Run it with e.g:

    EXTRA_REGRESS_OPTS="--temp-config=test.conf" meson test
---
 src/tools/testwrap | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/tools/testwrap b/src/tools/testwrap
index 8ae8fb79ba7..f52ca376da1 100755
--- a/src/tools/testwrap
+++ b/src/tools/testwrap
@@ -2,6 +2,7 @@
 
 import argparse
 import shutil
+import shlex
 import subprocess
 import os
 import sys
@@ -51,7 +52,12 @@ env_dict = {**os.environ,
 if "PG_TEST_EXTRA" not in env_dict and args.pg_test_extra:
     env_dict["PG_TEST_EXTRA"] = args.pg_test_extra
 
-sp = subprocess.Popen(args.test_command, env=env_dict, stdout=subprocess.PIPE)
+if args.testname in ['regress', 'isolation', 'ecpg'] and 'EXTRA_REGRESS_OPTS' in env_dict:
+    test_command = args.test_command + shlex.split(env_dict['EXTRA_REGRESS_OPTS'])
+else:
+    test_command = args.test_command
+
+sp = subprocess.Popen(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
 # directive, so Meson computes the file result like Perl does.  This could
-- 
2.47.2



view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Add support for EXTRA_REGRESS_OPTS for meson
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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