From 866e3e03dee38fab682c217b2b0b4c33874408fa Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 1 Feb 2021 10:10:09 +0100 Subject: Create .php and .sh on valgrind failure --- run-tests.php | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'run-tests.php') 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 = <<