Ah you are fast (less than 24 hours :)! Thank you Tony for the patch.
Can you please also merge it to PHP 5.2, so that I can upgrade valgrind in
the gcov machine?
Thanks,
Nuno
----- Original Message -----
From: "Antony Dovgal" <[EMAIL PROTECTED]>
To: <php-cvs@lists.php.net>
Sent: Wednesday, December 12, 2007 9:20 AM
Subject: [PHP-CVS] cvs: php-src / run-tests.php
tony2001 Wed Dec 12 09:20:42 2007 UTC
Modified files:
/php-src run-tests.php
Log:
add support for Valgrind 3.3.0 (which doesn't have --log-file-exactly
option)
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.332&r2=1.333&diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.332 php-src/run-tests.php:1.333
--- php-src/run-tests.php:1.332 Wed Nov 21 08:20:11 2007
+++ php-src/run-tests.php Wed Dec 12 09:20:41 2007
@@ -24,7 +24,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: run-tests.php,v 1.332 2007/11/21 08:20:11 jani Exp $ */
+/* $Id: run-tests.php,v 1.333 2007/12/12 09:20:41 tony2001 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
@@ -76,6 +76,8 @@
$cwd = getcwd();
set_time_limit(0);
+$valgrind_version = 0;
+
// delete as much output buffers as possible
while(@ob_end_clean());
if (ob_get_level()) echo "Not all buffers were deleted.\n";
@@ -408,7 +410,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
- echo '$Revision: 1.332 $'."\n";
+ echo '$Revision: 1.333 $'."\n";
exit(1);
default:
echo "Illegal switch specified!\n";
@@ -972,6 +974,7 @@
global $leak_check, $temp_source, $temp_target, $cfg, $environment;
global $no_clean;
global $unicode_and_native;
+ global $valgrind_version;
$temp_filenames = null;
$org_file = $file;
@@ -1441,7 +1444,26 @@
if ($leak_check) {
$env['USE_ZEND_ALLOC'] = '0';
- $cmd =
"valgrind -q --tool=memcheck --trace-children=yes --log-file-exactly=$memcheck_filename
$cmd";
+ 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";
+ } else {
+ $cmd =
"valgrind -q --tool=memcheck --trace-children=yes --log-file-exactly=$memcheck_filename
$cmd";
+ }
} else {
$env['USE_ZEND_ALLOC'] = '1';
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php