1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 01:18:19 +02:00

- MFH valgrind detection, note in header

This commit is contained in:
Marcus Boerger
2008-01-15 13:03:54 +00:00
parent 67e82261c2
commit 330c8b49f8
+15 -15
View File
@@ -77,6 +77,7 @@ $cwd = getcwd();
set_time_limit(0);
$valgrind_version = 0;
$valgrind_header = '';
// delete as much output buffers as possible
while(@ob_end_clean());
@@ -194,7 +195,7 @@ $ini_overwrites = array(
function write_information($show_html)
{
global $cwd, $php, $php_cgi, $php_info, $user_tests, $ini_overwrites, $pass_options, $exts_to_test;
global $cwd, $php, $php_cgi, $php_info, $user_tests, $ini_overwrites, $pass_options, $exts_to_test, $leak_check, $valgrind_header;
// Get info from php
$info_file = realpath(dirname(__FILE__)) . '/run-test-info.php';
@@ -248,6 +249,7 @@ Extra dirs : ";
echo "{$test_dir}\n ";
}
echo "
VALGRIND : " . ($leak_check ? $valgrind_header : 'Not used') . "
=====================================================================
";
}
@@ -367,6 +369,18 @@ if (isset($argc) && $argc > 1) {
//case 'l'
case 'm':
$leak_check = true;
$valgrind_cmd = "valgrind --version";
$valgrind_header = system_with_timeout($valgrind_cmd);
$replace_count = 0;
if (!$valgrind_header) {
error("Valgrind returned no version info, cannot proceed.\nPlease check if Valgrind is installed.");
} else {
$valgrind_version = preg_replace("/valgrind-([0-9])\.([0-9])\.([0-9]+)(-\w+)?(\s+)/", '$1$2$3', $valgrind_header, 1, $replace_count);
if ($replace_count != 1 || !is_numeric($valgrind_version)) {
error("Valgrind returned invalid version info (\"$valgrind_header\"), cannot proceed.");
}
$valgrind_header = trim($valgrind_header);
}
break;
case 'n':
if (!$pass_option_n) {
@@ -1435,20 +1449,6 @@ TEST $file
if ($leak_check) {
$env['USE_ZEND_ALLOC'] = '0';
if (!$valgrind_version) {
$valgrind_cmd = "valgrind --version";
$out = system_with_timeout($valgrind_cmd);
$replace_count = 0;
if (!$out) {
error("Valgrind returned no version info, cannot proceed.\nPlease check if Valgrind is installed.");
} else {
$valgrind_version = preg_replace("/valgrind-([0-9])\.([0-9])\.([0-9]+)(\s+)/", '$1$2$3', $out, 1, $replace_count);
if ($replace_count != 1 || !is_numeric($valgrind_version)) {
error("Valgrind returned invalid version info (\"$out\"), cannot proceed.");
}
}
}
if ($valgrind_version >= 330) {
/* valgrind 3.3.0+ doesn't have --log-file-exactly option */
$cmd = "valgrind -q --tool=memcheck --trace-children=yes --log-file=$memcheck_filename $cmd";