Commit c48fc1e7ab5 for php.net
commit c48fc1e7ab55677833d0e1c4082689154aee769a
Author: Tim Düsterhus <tim@tideways-gmbh.com>
Date: Wed Aug 5 22:20:58 2026 +0200
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 <tim@tideways-gmbh.com>
* 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 <github@derickrethans.nl>
diff --git a/run-tests.php b/run-tests.php
index 89bd8ffb797..89b5882f667 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;