[PHP-CVS] [php-src] master: run-tests: Improve handling of test reproduction helpers (#23066)

[email protected] (Tim Düsterhus via GitHub) Wed, 5 Aug 2026 20:21:01 +0000
Newsgroups php.cvs
Message-ID <[email protected]>
Author: Tim Düsterhus (TimWolla)
Committer: GitHub (web-flow)
Pusher: TimWolla
Date: 2026-08-05T22:20:58+02:00

Commit: https://github.com/php/php-src/commit/c48fc1e7ab55677833d0e1c4082689154aee769a
Raw diff: https://github.com/php/php-src/commit/c48fc1e7ab55677833d0e1c4082689154aee769a.diff

run-tests: Improve handling of test reproduction helpers (#23066)

* run-tests: Add `strace` sub command for generated test reproduction scripts

Co-authored-by: Tim Düsterhus <[email protected]>

* run-tests: Pass all provided arguments to `valgrind`

* run-tests: Pass all provided arguments to `gdb`

* run-tests: Pass all provided arguments to `lldb`

* run-tests: `exec` into test reproduction helpers

This avoids needlessly carrying around the shell and provides more direct
access to the running executable.

---------

Co-authored-by: Derick Rethans <[email protected]>

Changed paths:
  M  run-tests.php


Diff:

diff --git a/run-tests.php b/run-tests.php
index 89bd8ffb797c..89b5882f6674 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -2920,19 +2920,27 @@ function run_test(string $php, $file, array $env): string
 {$exported_environment}
 case "$1" in
 "gdb")
-    gdb -ex 'unset environment LINES' -ex 'unset environment COLUMNS' --args {$orig_cmd}
+    shift
+    exec gdb -ex 'unset environment LINES' -ex 'unset environment COLUMNS' "$@" --args {$orig_cmd}
     ;;
 "lldb")
-    lldb -- {$orig_cmd}
+    shift
+    exec lldb "$@" -- {$orig_cmd}
     ;;
 "valgrind")
-    USE_ZEND_ALLOC=0 valgrind $2 {$orig_cmd}
+    export USE_ZEND_ALLOC=0
+    shift
+    exec valgrind "$@" {$orig_cmd}
+    ;;
+"strace")
+    shift
+    exec strace "$@" {$orig_cmd}
     ;;
 "rr")
-    rr record $2 {$orig_cmd}
+    exec rr record $2 {$orig_cmd}
     ;;
 *)
-    {$orig_cmd}
+    exec {$orig_cmd}
     ;;
 esac
 SH;