Attached is v2 rebased on master at 8e82d6610e7. It combines
executable-wrapper support in the regression harness with the
meson.can_run_host_binaries() guard for ECPG tests.

Configuration checks found 135 ECPG targets for native ARM64, directly
runnable x64, and x64 with a Python wrapper; zero were exposed when a
required wrapper was missing. ECPG generation of thread/alloc.c
through the wrapper passed, as did direct and quoted-wrapper
regression-harness smoke checks.

Full ARM64 and x64 builds passed. ECPG passed all 66 subtests on
native ARM64 and directly runnable x64 under ARM64 emulation. The
ARM64 rerun passed after adding the missing diff tool to PATH. These
results do not establish full database regression coverage through the
Python wrapper.

Could someone review the wrapper handling and ECPG guard?

A separate GitHub-hosted Windows x64 build and all nine test groups
passed with all three patches applied. ECPG passed all 66 subtests on
the GitHub Windows x64 runner.

Best,
Harrison
From 1c24ed9c389932b520ef7dac9469967e28638b74 Mon Sep 17 00:00:00 2001
From: Harrison Booth <[email protected]>
Date: Mon, 12 Oct 2026 15:54:34 -0500
Subject: [PATCH v2] meson: Support ECPG tests in runnable cross builds

Use can_run_host_binaries() to enable ECPG tests for runnable cross builds.
Make the regression test wrapper honor MESON_EXE_WRAPPER and resolve
relative runner paths, so execution through a wrapper also works.
---
 meson.build                          |  2 +-
 src/interfaces/ecpg/test/meson.build |  4 ++--
 src/tools/testwrap                   | 15 ++++++++++++++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index d05634fef0d..61f0348058a 100644
--- a/meson.build
+++ b/meson.build
@@ -3992,7 +3992,7 @@ foreach test_dir : tests
         fallback_dbname.format(test_dir['name']))
 
       test_command_base = [
-        runner.full_path(),
+        runner,
         '--inputdir', t.get('inputdir', test_dir['sd']),
         '--expecteddir', t.get('expecteddir', test_dir['sd']),
         '--bindir', '',
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index 7f5b950c186..9397dd4d6f7 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -1,7 +1,7 @@
 # Copyright (c) 2022-2026, PostgreSQL Global Development Group
 
-# can't run ecpg to build test dependencies, at least not without an emulator
-if meson.is_cross_build()
+# We need to run ecpg to build test dependencies.
+if not meson.can_run_host_binaries()
   subdir_done()
 endif
 
diff --git a/src/tools/testwrap b/src/tools/testwrap
index e91296ecd15..6301cd4faed 100755
--- a/src/tools/testwrap
+++ b/src/tools/testwrap
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 import argparse
+import shlex
 import shutil
 import subprocess
 import os
@@ -20,6 +21,9 @@ parser.add_argument('test_command', nargs='*')
 
 args = parser.parse_args()
 
+if args.test_command and not os.path.isabs(args.test_command[0]):
+    args.test_command[0] = os.path.join(args.basedir, args.test_command[0])
+
 testdir = '{}/testrun/{}/{}'.format(
     args.basedir, args.testgroup, args.testname)
 
@@ -61,7 +65,16 @@ else:
     if args.tests:
         args.test_command.extend(args.tests)
 
-sp = subprocess.Popen(args.test_command, env=env_dict, stdout=subprocess.PIPE)
+test_command = args.test_command
+exe_wrapper = env_dict.get('MESON_EXE_WRAPPER')
+if exe_wrapper:
+    if os.name == 'nt':
+        test_command = '{} {}'.format(
+            exe_wrapper, subprocess.list2cmdline(test_command))
+    else:
+        test_command = shlex.split(exe_wrapper) + 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

Reply via email to