Re: SEGV support for run-tests

From: Date: Thu, 03 Jul 2014 07:23:13 +0000
Subject: Re: SEGV support for run-tests
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-75200@lists.php.net to get a copy of this message
On 3 July 2014 09:09, Michael Wallner <mike@php.net> wrote: > Internals, > > after a related discussion on IRC I tossed SEGV support into run-tests: > http://sprunge dot us/SXZZ > http://sprunge dot us/gfTA > > Thoughts? > > See attachment, those URLs have been spam-blocked. -- Regards, Mike

diff --git a/run-tests.php b/run-tests.php index 1b5bcec..6cb8564 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1066,7 +1066,7 @@ function error_report($testname, $logname, $tested) } } -function system_with_timeout($commandline, $env = null, $stdin = null) +function system_with_timeout($commandline, $env = null, $stdin = null, &$code = null) { global $leak_check, $cwd; @@ -1127,6 +1127,11 @@ function system_with_timeout($commandline, $env = null, $stdin = null) } $code = proc_close($proc); + + if ($stat["exitcode"] > 128) { + $code = $stat["exitcode"] - 128; + } + return $data; } @@ -1811,7 +1816,8 @@ COMMAND $cmd junit_start_timer($shortname); - $out = system_with_timeout($cmd, $env, isset($section_text['STDIN']) ? $section_text['STDIN'] : null); + $out = system_with_timeout($cmd, $env, isset($section_text['STDIN']) ? $section_text['STDIN'] : null, $code); + $segv = $code === 11; junit_finish_timer($shortname); @@ -1996,7 +2002,7 @@ COMMAND $cmd $php = $old_php; } - if (!$leaked && !$failed_headers) { + if (!$leaked && !$failed_headers && !$segv) { if (isset($section_text['XFAIL'] )) { $warn = true; $info = " (warn: XFAIL section but test passes)"; @@ -2026,7 +2032,7 @@ COMMAND $cmd $php = $old_php; } - if (!$leaked && !$failed_headers) { + if (!$leaked && !$failed_headers && !$segv) { if (isset($section_text['XFAIL'] )) { $warn = true; $info = " (warn: XFAIL section but test passes)"; @@ -2052,6 +2058,10 @@ COMMAND $cmd } } + if ($segv) { + $restype[] = 'SEGV'; + } + if ($leaked) { $restype[] = 'LEAK'; } @@ -2337,7 +2347,8 @@ function compute_summary() 'FAILED' => 0, 'BORKED' => 0, 'LEAKED' => 0, - 'XFAILED' => 0 + 'XFAILED' => 0, + 'SEGVED' => 0 ); foreach ($test_results as $v) { @@ -2363,6 +2374,7 @@ function get_summary($show_ext_summary, $show_html) $x_failed = (100.0 * $sum_results['FAILED']) / $x_total; $x_xfailed = (100.0 * $sum_results['XFAILED']) / $x_total; $x_leaked = (100.0 * $sum_results['LEAKED']) / $x_total; + $x_segved = (100.0 * $sum_results['SEGVED']) / $x_total; $x_passed = (100.0 * $sum_results['PASSED']) / $x_total; } else { $x_warned = $x_failed = $x_passed = $x_leaked = $x_xfailed = 0; @@ -2405,6 +2417,7 @@ Tests leaked : ' . sprintf('%4d (%5.1f%%)', $sum_results['LEAKED'], $percent_ } $summary .= ' +Tests crashed : ' . sprintf('%4d (%5.1f%%)', $sum_results['SEGVED'], $percent_results['SEGVED']) . ' ' . sprintf('(%5.1f%%)', $x_segved) . ' Tests passed : ' . sprintf('%4d (%5.1f%%)', $sum_results['PASSED'], $percent_results['PASSED']) . ' ' . sprintf('(%5.1f%%)', $x_passed) . ' --------------------------------------------------------------------- Time taken : ' . sprintf('%4d seconds', $end_time - $start_time) . '
« previous php.internals (#75200) next »