helly Tue Jan 15 13:03:54 2008 UTC Modified files: (Branch: PHP_5_3) /php-src run-tests.php Log: - MFH valgrind detection, note in header http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.226.2.37.2.35.2.13&r2=1.226.2.37.2.35.2.14&diff_format=u Index: php-src/run-tests.php diff -u php-src/run-tests.php:1.226.2.37.2.35.2.13 php-src/run-tests.php:1.226.2.37.2.35.2.14 --- php-src/run-tests.php:1.226.2.37.2.35.2.13 Sun Jan 6 16:48:11 2008 +++ php-src/run-tests.php Tue Jan 15 13:03:54 2008 @@ -24,7 +24,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: run-tests.php,v 1.226.2.37.2.35.2.13 2008/01/06 16:48:11 helly Exp $ */ +/* $Id: run-tests.php,v 1.226.2.37.2.35.2.14 2008/01/15 13:03:54 helly Exp $ */ /* Sanity check to ensure that pcre extension needed by this script is available. * In the event it is not, print a nice error message indicating that this script will @@ -77,6 +77,7 @@ set_time_limit(0); $valgrind_version = 0; +$valgrind_header = ''; // delete as much output buffers as possible while(@ob_end_clean()); @@ -194,7 +195,7 @@ 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 @@ echo "{$test_dir}\n "; } echo " +VALGRIND : " . ($leak_check ? $valgrind_header : 'Not used') . " ===================================================================== "; } @@ -367,6 +369,18 @@ //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) { @@ -426,7 +440,7 @@ $html_output = is_resource($html_file); break; case '--version': - echo '$Revision: 1.226.2.37.2.35.2.13 $'."\n"; + echo '$Revision: 1.226.2.37.2.35.2.14 $'."\n"; exit(1); case 'u': @@ -1435,20 +1449,6 @@ 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";
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php