summaryrefslogtreecommitdiff
path: root/run-tests.php
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-12-12 20:21:57 +0000
committerAntony Dovgal <tony2001@php.net>2007-12-12 20:21:57 +0000
commit0e70b8fea065c771ad4c4b5b94673d85cba910ce (patch)
tree7fd854a464c849a0046deaa5383c756599f5dadc /run-tests.php
parent8f8e19dc7b5484839614c2cf97b3737b9229592e (diff)
downloadphp-git-0e70b8fea065c771ad4c4b5b94673d85cba910ce.tar.gz
MFH: add valgrind 3.3.0 support
Diffstat (limited to 'run-tests.php')
-rwxr-xr-xrun-tests.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/run-tests.php b/run-tests.php
index b54efad819..35d8e72ff4 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -76,6 +76,8 @@ putenv('SSH_CONNECTION=deleted');
$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";
@@ -950,6 +952,7 @@ function run_test($php, $file, $env)
global $pass_options, $DETAILED, $IN_REDIRECT, $test_cnt, $test_idx;
global $leak_check, $temp_source, $temp_target, $cfg, $environment;
global $no_clean;
+ global $valgrind_version;
$temp_filenames = null;
$org_file = $file;
@@ -1378,7 +1381,26 @@ TEST $file
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) {
+ $cmd = "valgrind -q --tool=memcheck --trace-children=yes --log-file-exactly=$memcheck_filename $cmd";
+ } else {
+ /* 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 {
$env['USE_ZEND_ALLOC'] = '1';
}