diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-01 10:10:09 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-01 10:10:09 +0100 |
commit | 866e3e03dee38fab682c217b2b0b4c33874408fa (patch) | |
tree | c925afdaf425112ed72386bfa8b5b064d4c8ba86 /run-tests.php | |
parent | 495a522b28b01785a074fa52bb9f4d9224492e90 (diff) | |
download | php-git-866e3e03dee38fab682c217b2b0b4c33874408fa.tar.gz |
Create .php and .sh on valgrind failure
Diffstat (limited to 'run-tests.php')
-rwxr-xr-x | run-tests.php | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/run-tests.php b/run-tests.php index a9f56f9484..613b1391e1 100755 --- a/run-tests.php +++ b/run-tests.php @@ -2503,6 +2503,7 @@ TEST $file $cmd = "$php $pass_options $repeat_option $ini_settings -f \"$test_file\" $args$cmdRedirect"; } + $orig_cmd = $cmd; if ($valgrind) { $env['USE_ZEND_ALLOC'] = '0'; $env['ZEND_DONT_UNLOAD_MODULES'] = 1; @@ -2705,7 +2706,7 @@ COMMAND $cmd if (preg_match("/^$wanted_re\$/s", $output)) { $passed = true; - if (!$cfg['keep']['php']) { + if (!$cfg['keep']['php'] && !$leaked) { @unlink($test_file); } @unlink($tmp_post); @@ -2810,6 +2811,20 @@ COMMAND $cmd error("Cannot create test diff - $diff_filename"); } + // write .log + if (strpos($log_format, 'L') !== false && file_put_contents($log_filename, " +---- EXPECTED OUTPUT +$wanted +---- ACTUAL OUTPUT +$output +---- FAILED +") === false) { + error("Cannot create test log - $log_filename"); + error_report($file, $log_filename, $tested); + } + } + + if (!$passed || $leaked) { // write .sh if (strpos($log_format, 'S') !== false) { $sh_script = <<<SH @@ -2817,16 +2832,16 @@ COMMAND $cmd case "$1" in "gdb") - gdb --args {$cmd} + gdb --args {$orig_cmd} ;; "valgrind") - USE_ZEND_ALLOC=0 valgrind $2 ${cmd} + USE_ZEND_ALLOC=0 valgrind $2 ${orig_cmd} ;; "rr") - rr record $2 ${cmd} + rr record $2 ${orig_cmd} ;; *) - {$cmd} + {$orig_cmd} ;; esac SH; @@ -2835,18 +2850,6 @@ SH; } chmod($sh_filename, 0755); } - - // write .log - if (strpos($log_format, 'L') !== false && file_put_contents($log_filename, " ----- EXPECTED OUTPUT -$wanted ----- ACTUAL OUTPUT -$output ----- FAILED -") === false) { - error("Cannot create test log - $log_filename"); - error_report($file, $log_filename, $tested); - } } if ($valgrind && $leaked && $cfg["show"]["mem"]) { |