Sorry. I attached wrong patch.

Dmitry.

> -----Original Message-----
> From: Dmitry Stogov [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, December 01, 2005 10:28 AM
> To: 'Marcus Boerger'; Nuno Lopes
> Cc: 'php-cvs@lists.php.net'
> Subject: RE: [PHP-CVS] cvs: php-src / run-tests.php 
> 
> 
> GREAT!
> 
> In addition, it would be nice to support "--suppressions" 
> valgrind option. On my system (FC4), valgrind always produces 
> the same pthread specific error on any run. Se patch in attachment.
> 
> Also it is possible to run valgrind wih "-q" option, so 
> valgrind will print it's own messages only on real errors, 
> and you will not need filter them.
> 
> Thanks. Dmitry.
> 
> > -----Original Message-----
> > From: Marcus Boerger [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, December 01, 2005 3:27 AM
> > To: php-cvs@lists.php.net
> > Subject: [PHP-CVS] cvs: php-src / run-tests.php 
> > 
> > 
> > helly               Wed Nov 30 19:26:45 2005 EDT
> > 
> >   Modified files:              
> >     /php-src        run-tests.php 
> >   Log:
> >   - Add support for valgrind testing (Nuno)
> >   
> > http://cvs.php.net/diff.php/php-src/run-tests.php?r1=1.239&r2=
> > 1.240&ty=u
> > Index: php-src/run-tests.php
> > diff -u php-src/run-tests.php:1.239 php-src/run-tests.php:1.240
> > --- php-src/run-tests.php:1.239     Sat Nov 26 13:07:49 2005
> > +++ php-src/run-tests.php   Wed Nov 30 19:26:44 2005
> > @@ -23,7 +23,7 @@
> >     
> > +-------------------------------------------------------------
> > ---------+
> >   */
> >  
> > -/* $Id: run-tests.php,v 1.239 2005/11/26 18:07:49 helly Exp $ */
> > +/* $Id: run-tests.php,v 1.240 2005/12/01 00:26:44 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 @@ -274,6 +274,9 @@
> >                                     $ini_overwrites[] = 
> > 'unicode.output_encoding=utf-8';
> >                                     $ini_overwrites[] = 
> > 'unicode.from_error_mode=U_INVALID_SUBSTITUTE';
> >                                     break;
> > +                           case 'm':
> > +                                   $GLOBALS['leak_check'] = 1;
> > +                                   break;
> >                             default:
> >                                     echo "Illegal switch
> > specified!\n";
> >                             case "h":
> > @@ -302,6 +305,8 @@
> >  
> >      -u          Test with unicode_semantics set on.
> >  
> > +    -m          Test for memory leaks with Valgrind
> > +
> >      -v          Verbose mode.
> >  
> >      -h <file>   This Help.
> > @@ -682,7 +687,7 @@
> >                     return $data;
> >             } else if ($n > 0) {
> >                     $line = fread($pipes[1], 8192);
> > -                   if (strlen($line) == 0) {
> > +                   if ($line === false) {
> >                             /* EOF */
> >                             break;
> >                     }
> > @@ -861,9 +866,10 @@
> >     $tmp_skipif = $tmp . DIRECTORY_SEPARATOR . uniqid('/phpt.');
> >     $tmp_file   = $tmp . DIRECTORY_SEPARATOR . 
> > preg_replace('/\.phpt$/','.php',basename($file));
> >     $tmp_post   = $tmp . DIRECTORY_SEPARATOR . uniqid('/phpt.');
> > +   $tmp_relative_file =
> > +str_replace(dirname(__FILE__).DIRECTORY_SEPARATOR, '', 
> $tmp_file) . 
> > +'t';
> >  
> >     if (is_array($IN_REDIRECT)) {
> > -           $tested = $IN_REDIRECT['prefix'] . ' ' . 
> > trim($section_text['TEST']) . " [$tmp_file]";
> > +           $tested = $IN_REDIRECT['prefix'] . ' ' .
> > trim($section_text['TEST'])
> > +. " [$tmp_relative_file]";
> >             $section_text['FILE'] = "# original source
> > file: $shortname\n" . $section_text['FILE'];
> >     }
> >  
> > @@ -1077,6 +1083,10 @@
> >             }
> >     }
> >  
> > +   if (isset($GLOBALS['leak_check'])) {
> > +           $cmd = 'valgrind --tool=memcheck ' . $cmd;
> > +   }
> > +
> >     if ($DETAILED) echo "
> >  CONTENT_LENGTH  = " . getenv("CONTENT_LENGTH") . "
> >  CONTENT_TYPE    = " . getenv("CONTENT_TYPE") . "
> > @@ -1100,6 +1110,31 @@
> >  
> >     @unlink($tmp_post);
> >  
> > +   if (isset($GLOBALS['leak_check'])) { // leak check
> > +           preg_match_all('/==\d+== +\w+ lost: (\d+)
> > bytes/S', $out, $matches);
> > +           $leak = false;
> > +
> > +           foreach ($matches[1] as $m) {
> > +                   if ($m) { // we got a leak
> > +                           $leak = true;
> > +                           break;
> > +                   }
> > +           }
> > +
> > +           if (!$leak && !preg_match('/==\d+== ERROR
> > SUMMARY: [1-9]\d* errors/', $out)) {
> > +                   if (isset($old_php)) {
> > +                           $php = $old_php;
> > +                   }
> > +                   echo "PASS $tested\n";
> > +                   return 'PASSED';
> > +           }
> > +
> > +           $output = $out;
> > +           $wanted = '';
> > +           $warn = false;
> > +
> > +   } else { // normal testing
> > +
> >     // Does the output match what is expected?
> >     $output = trim($out);
> >     $output = preg_replace('/\r\n/',"\n",$output);
> > @@ -1158,6 +1193,8 @@
> >             $wanted_re = NULL;
> >     }
> >  
> > +   } //end of non-valgrind testing
> > +
> >     // Test failed so we need to report details.
> >     if ($warn) {
> >             show_result("WARN", $tested, $file, $info);
> > @@ -1190,7 +1227,7 @@
> >     // write .diff
> >     if (strpos($log_format,'D') !== FALSE) {
> >             $log = fopen($diff_filename,'wt') or
> > error("Cannot create test log - $diff_filename");
> > -           fwrite($log,generate_diff($wanted,$wanted_re,$output));
> > +           fwrite($log, isset($GLOBALS['leak_check']) ? '' :
> > +generate_diff($wanted,$wanted_re,$output));
> >             fclose($log);
> >     }
> >  
> > 
> > --
> > PHP CVS Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to