Skip to content

Commit ec88bbc

Browse files
committed
Enhance test failure SH script to allow gdb, valgrind, rr as alternative modes.
1 parent 826a745 commit ec88bbc

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

run-tests.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,10 +2748,24 @@ function run_test($php, $file, $env)
27482748
}
27492749

27502750
// write .sh
2751-
if (strpos($log_format, 'S') !== false && file_put_contents($sh_filename, "#!/bin/sh
2752-
2753-
{$cmd}
2754-
", FILE_BINARY) === false) {
2751+
if (strpos($log_format, 'S') !== false && file_put_contents($sh_filename, <<<SH
2752+
#!/bin/sh
2753+
2754+
case "$1" in
2755+
"gdb")
2756+
gdb --args {$cmd}
2757+
;;
2758+
"valgrind")
2759+
USE_ZEND_ALLOC=0 valgrind $2 ${cmd}
2760+
;;
2761+
"rr")
2762+
rr record $2 ${cmd}
2763+
;;
2764+
*)
2765+
{$cmd}
2766+
;;
2767+
esac
2768+
SH, FILE_BINARY) === false) {
27552769
error("Cannot create test shell script - $sh_filename");
27562770
}
27572771
chmod($sh_filename, 0755);

0 commit comments

Comments
 (0)