From: Nikita Popov Date: Mon, 1 Feb 2021 09:10:09 +0000 (+0100) Subject: Create .php and .sh on valgrind failure X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=866e3e03dee38fab682c217b2b0b4c33874408fa;p=php Create .php and .sh on valgrind failure --- 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 = <<