r45191 - in /trunk/libtest-valgrind-perl: ./ debian/ lib/Test/ lib/Test/Valgrind/ lib/Test/Valgrind/Action/ lib/Test/Valgrind/Command/ lib/Test/Valgrind/Parser/ lib/Test/Valgrind/Tool/ samples/ t/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Thu Oct 1 20:34:04 UTC 2009


Author: gregoa
Date: Thu Oct  1 20:33:59 2009
New Revision: 45191

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=45191
Log:
New upstream release (closes: #546515).

Added:
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Component.pm
      - copied unchanged from r45190, branches/upstream/libtest-valgrind-perl/current/lib/Test/Valgrind/Component.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Parser/
      - copied from r45190, branches/upstream/libtest-valgrind-perl/current/lib/Test/Valgrind/Parser/
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Parser.pm
      - copied unchanged from r45190, branches/upstream/libtest-valgrind-perl/current/lib/Test/Valgrind/Parser.pm
    trunk/libtest-valgrind-perl/samples/xml-output-protocol4.txt
      - copied unchanged from r45190, branches/upstream/libtest-valgrind-perl/current/samples/xml-output-protocol4.txt
    trunk/libtest-valgrind-perl/t/70-session.t
      - copied unchanged from r45190, branches/upstream/libtest-valgrind-perl/current/t/70-session.t
Removed:
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool/SuppressionsParser.pm
Modified:
    trunk/libtest-valgrind-perl/Changes
    trunk/libtest-valgrind-perl/MANIFEST
    trunk/libtest-valgrind-perl/META.yml
    trunk/libtest-valgrind-perl/Makefile.PL
    trunk/libtest-valgrind-perl/README
    trunk/libtest-valgrind-perl/debian/changelog
    trunk/libtest-valgrind-perl/lib/Test/Valgrind.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Captor.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Suppressions.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Test.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Carp.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Aggregate.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Perl.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/PerlScript.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Report.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Session.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Suppressions.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool.pm
    trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool/memcheck.pm
    trunk/libtest-valgrind-perl/t/80-suppressions.t
    trunk/libtest-valgrind-perl/t/92-pod-coverage.t

Modified: trunk/libtest-valgrind-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/Changes?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/Changes (original)
+++ trunk/libtest-valgrind-perl/Changes Thu Oct  1 20:33:59 2009
@@ -1,4 +1,16 @@
 Revision history for Test-Valgrind
+
+1.10    2009-09-22 18:45 UTC
+        + Chg : valgrind is no longer required to be installed before installing
+                this module.
+        + Chg : The parser logic that used to be located inside the tool was
+                moved to a new Test::Valgrind::Parser hierarchy. The tool
+                decides which parser should be used by implementing the
+                "parser_class" method.
+        + Fix : Compatibility with valgrind 3.5.
+        + Fix : The "valgrind" option to Test::Valgrind::Session->new wasn't
+                doing anything.
+        + Fix : The "Test" action could generate inappropriate error messages.
 
 1.02    2009-05-02 12:05 UTC
         + Add : Commands can now be aggregated.

Modified: trunk/libtest-valgrind-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/MANIFEST?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/MANIFEST (original)
+++ trunk/libtest-valgrind-perl/MANIFEST Thu Oct  1 20:33:59 2009
@@ -14,17 +14,24 @@
 lib/Test/Valgrind/Command/Aggregate.pm
 lib/Test/Valgrind/Command/Perl.pm
 lib/Test/Valgrind/Command/PerlScript.pm
+lib/Test/Valgrind/Component.pm
+lib/Test/Valgrind/Parser.pm
+lib/Test/Valgrind/Parser/Suppressions/Text.pm
+lib/Test/Valgrind/Parser/Text.pm
+lib/Test/Valgrind/Parser/XML.pm
+lib/Test/Valgrind/Parser/XML/Twig.pm
 lib/Test/Valgrind/Report.pm
 lib/Test/Valgrind/Session.pm
 lib/Test/Valgrind/Suppressions.pm
 lib/Test/Valgrind/Tool.pm
-lib/Test/Valgrind/Tool/SuppressionsParser.pm
 lib/Test/Valgrind/Tool/memcheck.pm
 samples/map.pl
 samples/xml-output.txt
+samples/xml-output-protocol4.txt
 t/00-load.t
 t/10-good.t
 t/20-bad.t
+t/70-session.t
 t/80-suppressions.t
 t/91-pod.t
 t/92-pod-coverage.t

Modified: trunk/libtest-valgrind-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/META.yml?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/META.yml (original)
+++ trunk/libtest-valgrind-perl/META.yml Thu Oct  1 20:33:59 2009
@@ -1,21 +1,14 @@
 --- #YAML:1.0
 name:               Test-Valgrind
-version:            1.02
+version:            1.10
 abstract:           Generate suppressions, analyse and test any command with valgrind.
 author:
     - Vincent Pit <perl at profvince.com>
 license:            perl
 distribution_type:  module
 configure_requires:
-    base:                 0
-    Carp:                 0
-    Config:               0
     ExtUtils::MakeMaker:  0
-    Fcntl:                0
     File::Spec:           0
-    POSIX:                0
-    Scalar::Util:         0
-    version:              0
 build_requires:
     base:                 0
     Carp:                 0
@@ -28,6 +21,7 @@
     File::Spec:           0
     File::Temp:           0.14
     Filter::Util::Call:   0
+    List::Util:           0
     Perl::Destruct::Level:  0
     POSIX:                0
     Scalar::Util:         0
@@ -46,11 +40,13 @@
     File::Spec:           0
     File::Temp:           0.14
     Filter::Util::Call:   0
+    List::Util:           0
     perl:                 5.006
     Perl::Destruct::Level:  0
     POSIX:                0
     Scalar::Util:         0
     Test::Builder:        0
+    Test::More:           0
     version:              0
     XML::Twig:            0
 resources:
@@ -62,7 +58,7 @@
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.50
+generated_by:       ExtUtils::MakeMaker version 6.54
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: trunk/libtest-valgrind-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/Makefile.PL?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/Makefile.PL (original)
+++ trunk/libtest-valgrind-perl/Makefile.PL Thu Oct  1 20:33:59 2009
@@ -4,28 +4,12 @@
 use warnings;
 use ExtUtils::MakeMaker;
 
-my $has_version_pm;
 BEGIN {
  eval { require Config };
  die 'OS unsupported' if $@;
  Config->import(qw/%Config/);
  eval { require File::Spec };
  die 'OS unsupported' if $@;
- $has_version_pm = eval "require version; 1" || 0;
-}
-use lib 'lib';
-
-print 'Checking for valgrind ' . ('>= 3.1.0 ' x $has_version_pm) .'in PATH... ';
-require Test::Valgrind::Session;
-my $vg = eval q[
- Test::Valgrind::Session->new((min_version => '3.1.0') x $has_version_pm)
-                        ->valgrind
-];
-if ($vg) {
- print "$vg\n";
-} else {
- print "no\n";
- die 'OS unsupported';
 }
 
 # Inspired from Module::Install::Can
@@ -67,10 +51,12 @@
  'File::Temp'            => '0.14', # OO interface
  'Filter::Util::Call'    => 0,
  'Fcntl'                 => 0,
+ 'List::Util'            => 0,
  'POSIX'                 => 0,
  'Perl::Destruct::Level' => 0,
  'Scalar::Util'          => 0,
  'Test::Builder'         => 0,
+ 'Test::More'            => 0,
  'XML::Twig'             => 0,
  'base'                  => 0,
  'version'               => 0,
@@ -80,15 +66,8 @@
 
 my %META = (
  configure_requires => {
-  'Carp'                => 0,
-  'Config'              => 0,
+  'File::Spec'          => 0,
   'ExtUtils::MakeMaker' => 0,
-  'Fcntl'               => 0,
-  'File::Spec'          => 0,
-  'POSIX'               => 0,
-  'Scalar::Util'        => 0,
-  'base'                => 0,
-  'version'             => 0,
  },
  build_requires => {
   'ExtUtils::MakeMaker' => 0,

Modified: trunk/libtest-valgrind-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/README?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/README (original)
+++ trunk/libtest-valgrind-perl/README Thu Oct  1 20:33:59 2009
@@ -3,7 +3,7 @@
     with valgrind.
 
 VERSION
-    Version 1.02
+    Version 1.10
 
 SYNOPSIS
         # From the command-line

Modified: trunk/libtest-valgrind-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/debian/changelog?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/debian/changelog (original)
+++ trunk/libtest-valgrind-perl/debian/changelog Thu Oct  1 20:33:59 2009
@@ -1,4 +1,4 @@
-libtest-valgrind-perl (1.02-2) UNRELEASED; urgency=low
+libtest-valgrind-perl (1.10-1) UNRELEASED; urgency=low
 
   [ Nathan Handler ]
   * debian/watch: Update to ignore development releases.
@@ -11,7 +11,10 @@
   [ Ryan Niebur ]
   * Update jawnsy's email address
 
- -- Ryan Niebur <ryanryan52 at gmail.com>  Tue, 01 Sep 2009 21:19:52 -0700
+  [ gregor herrmann ]
+  * New upstream release (closes: #546515).
+
+ -- gregor herrmann <gregoa at debian.org>  Thu, 01 Oct 2009 22:31:03 +0200
 
 libtest-valgrind-perl (1.02-1) unstable; urgency=low
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
-
-=cut
-
-our $VERSION = '1.02';
+Version 1.10
+
+=cut
+
+our $VERSION = '1.10';
 
 =head1 SYNOPSIS
 
@@ -168,7 +168,9 @@
   );
  };
  unless ($sess) {
-  $action->abort($sess, $@);
+  my $err = $@;
+  $err =~ s/^(Empty valgrind candidates list|No appropriate valgrind executable could be found)\s+at.*/$1/;
+  $action->abort($sess, $err);
   return $action->status($sess);
  }
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 
@@ -23,7 +23,7 @@
 
 =cut
 
-use base qw/Test::Valgrind::Carp/;
+use base qw/Test::Valgrind::Component Test::Valgrind::Carp/;
 
 =head1 METHODS
 
@@ -49,11 +49,7 @@
   return $action->new(%args);
  }
 
- my $self = bless { }, $class;
-
- $self->started(undef);
-
- $self;
+ $class->SUPER::new(@_);
 }
 
 =head2 C<do_suppressions>
@@ -64,37 +60,18 @@
 
 sub do_suppressions { 0 }
 
-=head2 C<started>
-
-Specifies whether the action is running (C<1>), stopped (C<0>) or was never started (C<undef>).
-
-=cut
-
-sub started { @_ <= 1 ? $_[0]->{started} : ($_[0]->{started} = $_[1]) }
-
 =head2 C<start $session>
 
 Called when the C<$session> starts.
 
-Defaults to set L</started>.
-
-=cut
-
-sub start {
- my ($self) = @_;
-
- $self->_croak('Action already started') if $self->started;
- $self->started(1);
-
- return;
-}
+Defaults to set L<Test::Valgrind::Component/started>.
 
 =head2 C<report $session, $report>
 
 Invoked each time the C<valgrind> process attached to the C<$session> spots an error.
 C<$report> is a L<Test::Valgrind::Report> object describing the error.
 
-Defaults to check L</started>.
+Defaults to check L<Test::Valgrind::Component/started>.
 
 =cut
 
@@ -120,18 +97,7 @@
 
 Called when the C<$session> finishes.
 
-Defaults to clear L</started>.
-
-=cut
-
-sub finish {
- my ($self) = @_;
-
- return unless $self->started;
- $self->started(0);
-
- return;
-}
+Defaults to clear L<Test::Valgrind::Component/started>.
 
 =head2 C<status $session>
 
@@ -152,7 +118,7 @@
 
 =head1 SEE ALSO
 
-L<Test::Valgrind>, L<Test::Valgrind::Session>.
+L<Test::Valgrind>, L<Test::Valgrind::Component>, L<Test::Valgrind::Session>.
 
 =head1 AUTHOR
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Captor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Captor.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Captor.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Captor.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Suppressions.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Suppressions.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Suppressions.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Suppressions.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Test.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Test.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Test.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Action/Test.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
-
-=cut
-
-our $VERSION = '1.02';
+Version 1.10
+
+=cut
+
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 
@@ -110,10 +110,10 @@
  my $tb = Test::Builder->new;
  my $plan = $tb->has_plan;
  if (defined $plan) {
-  $tb->BAIL_OUT($@);
+  $tb->BAIL_OUT($msg);
   $self->{status} = 255;
  } else {
-  $tb->skip_all($@);
+  $tb->skip_all($msg);
   $self->{status} = 0;
  }
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Carp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Carp.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Carp.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Carp.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 sub _croak {
  shift;

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Aggregate.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Aggregate.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Aggregate.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Aggregate.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Perl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Perl.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Perl.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/Perl.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
-
-=cut
-
-our $VERSION = '1.02';
+Version 1.10
+
+=cut
+
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/PerlScript.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/PerlScript.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/PerlScript.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Command/PerlScript.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Report.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Report.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Report.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Report.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 use base qw/Test::Valgrind::Carp/;
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Session.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Session.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Session.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Session.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
-
-=cut
-
-our $VERSION = '1.02';
+Version 1.10
+
+=cut
+
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 
@@ -22,19 +22,15 @@
 
 =cut
 
-# All these modules are required at configure time.
-
-BEGIN {
- require File::Spec;
- require Scalar::Util;
-
- require Fcntl; # F_SETFD
- require POSIX; # SIGKILL
-}
+use File::Spec   ();
+use Scalar::Util ();
+
+use Fcntl (); # F_SETFD
+use POSIX (); # SIGKILL
+
+use version ();
 
 use base qw/Test::Valgrind::Carp/;
-
-use Test::Valgrind::Report;
 
 =head1 METHODS
 
@@ -79,11 +75,6 @@
 =back
 
 =cut
-
-my $build_version = sub {
- require version;
- version->new($_[0]);
-};
 
 sub new {
  my $class = shift;
@@ -92,7 +83,7 @@
  my %args = @_;
 
  my @paths;
- my $vg = delete $args{vg};
+ my $vg = delete $args{valgrind};
  if (defined $vg and not ref $vg) {
   @paths = ($vg);
  } else {
@@ -105,7 +96,7 @@
  $class->_croak('Empty valgrind candidates list') unless @paths;
 
  my $min_version = delete $args{min_version};
- defined and not ref and $_ = $build_version->($_) for $min_version;
+ defined and not ref and $_ = version->new($_) for $min_version;
 
  my ($valgrind, $version);
  for (@paths) {
@@ -113,7 +104,7 @@
   my $ver = qx/$_ --version/;
   if ($ver =~ /^valgrind-(\d+(\.\d+)*)/) {
    if ($min_version) {
-    $version = $build_version->($1);
+    $version = version->new($1);
     next if $version < $min_version;
    } else {
     $version = $1;
@@ -151,7 +142,7 @@
  my ($self) = @_;
 
  my $version = $self->{version};
- $self->{version} = $version = $build_version->($version) unless ref $version;
+ $self->{version} = $version = version->new($version) unless ref $version;
 
  return $version;
 }
@@ -201,7 +192,7 @@
 
  $self->command($cmd);
 
- $self->report(Test::Valgrind::Report->new_diag(
+ $self->report($self->report_class->new_diag(
   'Using valgrind ' . $self->version . ' located at ' . $self->valgrind
  ));
 
@@ -210,21 +201,22 @@
  my @supp_args;
  if ($self->do_suppressions) {
   push @supp_args, '--gen-suppressions=all';
- } else {
-  my @supps;
-  if (not $self->no_def_supp) {
-   my $def_supp = $self->def_supp_file;
-   if (defined $def_supp and not -e $def_supp) {
-    $self->report(Test::Valgrind::Report->new_diag("Generating suppressions..."));
-    require Test::Valgrind::Suppressions;
-    Test::Valgrind::Suppressions->generate(
-     tool    => $self->tool,
-     command => $self->command,
-     target  => $def_supp,
-    );
-    $self->_croak('Couldn\'t generate suppressions') unless -e $def_supp;
-    $self->report(Test::Valgrind::Report->new_diag("Suppressions for this perl stored in $def_supp"));
-   }
+ } elsif (not $self->no_def_supp) {
+  my $def_supp = $self->def_supp_file;
+  if (defined $def_supp and not -e $def_supp) {
+   $self->report($self->report_class->new_diag(
+    "Generating suppressions..."
+   ));
+   require Test::Valgrind::Suppressions;
+   Test::Valgrind::Suppressions->generate(
+    tool    => $self->tool,
+    command => $self->command,
+    target  => $def_supp,
+   );
+   $self->_croak('Couldn\'t generate suppressions') unless -e $def_supp;
+   $self->report($self->report_class->new_diag(
+    "Suppressions for this perl stored in $def_supp"
+   ));
   }
   push @supp_args, '--suppressions=' . $_ for $self->suppressions;
  }
@@ -247,13 +239,13 @@
 
   my @args = (
    $self->valgrind,
-   '--log-fd=' . fileno($vwtr),
    $self->tool->args($self),
    @supp_args,
+   $self->parser->args($self, $vwtr),
    $self->command->args($self),
   );
 
-#  $self->report(Test::Valgrind::Report->new_diag("@args"));
+#  $self->report($self->report_class->new_diag("@args"));
 
   exec { $args[0] } @args or $self->_croak("exec @args: $!");
  }
@@ -266,7 +258,7 @@
 
  close $vwtr or $self->_croak("close(\$vwtr): $!");
 
- $self->tool->parse($self, $vrdr);
+ $self->parser->parse($self, $vrdr);
 
  $self->{exit_code} = (waitpid($pid, 0) == $pid) ? $? >> 8 : 255;
 
@@ -284,6 +276,10 @@
 =head2 C<tool>
 
 Read-only accessor for the C<tool> associated to the current run.
+
+=head2 C<parser>
+
+Read-only accessor for the C<parser> associated to the current tool.
 
 =head2 C<command>
 
@@ -293,7 +289,7 @@
 
 my @members;
 BEGIN {
- @members = qw/action tool command/;
+ @members = qw/action tool command parser/;
  for (@members) {
   eval "sub $_ { \@_ <= 1 ? \$_[0]->{$_} : (\$_[0]->{$_} = \$_[1]) }";
   die if $@;
@@ -310,7 +306,7 @@
 
 =head2 C<report_class>
 
-Calls C<< ->action->report_class >> with the current session object as the sole argument.
+Calls C<< ->action->report_class >> with the current session object as the unique argument.
 
 =cut
 
@@ -378,7 +374,7 @@
 
  my %args = @_;
 
- for (@members) {
+ for (qw/action tool command/) {
   my $base = 'Test::Valgrind::' . ucfirst;
   my $value = $args{$_};
   $self->_croak("Invalid $_") unless Scalar::Util::blessed($value)
@@ -389,6 +385,7 @@
  delete @{$self}{qw/last_status exit_code/};
 
  $self->tool->start($self);
+ $self->parser($self->tool->parser_class($self)->new)->start($self);
  $self->action->start($self);
 
  return;
@@ -402,6 +399,7 @@
 
 sub abort {
  my $self = shift;
+
  $self->action->abort($self, @_);
 }
 
@@ -416,8 +414,10 @@
 
  return unless defined $report;
 
- $report = $self->command->filter($self, $report);
- return unless defined $report;
+ for my $handler (qw/tool command/) {
+  $report = $self->$handler->filter($self, $report);
+  return unless defined $report;
+ }
 
  $self->action->report($self, $report);
 }
@@ -433,7 +433,9 @@
  my ($self) = @_;
 
  my $action = $self->action;
+
  $action->finish($self);
+ $self->parser->finish($self);
  $self->tool->finish($self);
 
  my $status = $action->status($self);
@@ -454,7 +456,7 @@
 
 =head1 SEE ALSO
 
-L<Test::Valgrind>, L<Test::Valgrind::Action>, L<Test::Valgrind::Tool>, L<Test::Valgrind::Command>.
+L<Test::Valgrind>, L<Test::Valgrind::Action>, L<Test::Valgrind::Command>, L<Test::Valgrind::Tool>, L<Test::Valgrind::Parser>.
 
 L<version>, L<File::HomeDir>.
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Suppressions.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Suppressions.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Suppressions.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Suppressions.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
+Version 1.10
 
 =cut
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 
@@ -24,7 +24,7 @@
 
 =cut
 
-use base qw/Test::Valgrind::Carp/;
+use base qw/Test::Valgrind::Component Test::Valgrind::Carp/;
 
 =head1 METHODS
 
@@ -58,7 +58,7 @@
   return $tool->new(%args);
  }
 
- bless { }, $class;
+ $class->SUPER::new(@_);
 }
 
 =head2 C<new_trainer>
@@ -71,23 +71,17 @@
 
 sub new_trainer { }
 
-=head2 C<report_class $session>
+=head2 C<parser_class $session>
 
-Wraps around either L</report_class_suppressions> or L</report_class_analysis> depending on the running mode of the C<$session>.
+Returns the class from which the parser for this tool output will be instanciated.
+
+This method must be implemented when subclassing.
 
 =cut
 
-sub report_class {
- my ($self, $sess) = @_;
+sub parser_class;
 
- if ($sess->do_suppressions) {
-  $self->report_class_suppressions($sess);
- } else {
-  $self->report_class_analysis($sess);
- }
-}
-
-=head2 C<report_class_suppressions $session>
+=head2 C<report_class $session>
 
 Returns the class in which suppression reports generated by this tool will be blessed.
 
@@ -95,17 +89,7 @@
 
 =cut
 
-sub report_class_suppression;
-
-=head2 C<report_class_analysis $session>
-
-Returns the class in which error reports generated by this tool will be blessed.
-
-This method must be implemented when subclassing.
-
-=cut
-
-sub report_class_analysis;
+sub report_class;
 
 =head2 C<args $session>
 
@@ -116,7 +100,7 @@
 
 =cut
 
-sub args  { }
+sub args { }
 
 =head2 C<suppressions_tag $session>
 
@@ -132,61 +116,28 @@
 
 Called when the C<$session> starts.
 
-Defaults to void.
+Defaults to set L<Test::Valgrind::Component/started>.
+
+=head2 C<filter $session, $report>
+
+The <$session> calls this method after receiving a report from the parser and before letting the command filter it.
+You can either return a mangled C<$report> (which does not need to be a clone of the original) or C<undef> if you want the action to ignore it completely.
+
+Defaults to the identity function.
 
 =cut
 
-sub start { }
-
-=head2 C<parse $session, $fh>
-
-Wraps around either L</parse_suppressions> or L</parse_analysis> depending on the running mode of the C<$session>.
-
-=cut
-
-sub parse {
- my ($self, $sess, $fh) = @_;
-
- if ($sess->do_suppressions) {
-  $self->parse_suppressions($sess, $fh);
- } else {
-  $self->parse_analysis($sess, $fh);
- }
-}
-
-=head2 C<parse_suppressions $sesssion, $fh>
-
-Parse the suppression reports that the C<valgrind> process attached to the session C<$session> send through the filehandle C<$fh>.
-
-This method must be implemented when subclassing.
-
-=cut
-
-sub parse_suppressions;
-
-=head2 C<parse_analysis $sesssion, $fh>
-
-Parse the error reports sent by the C<valgrind> process attached to the session C<$session> through the filehandle C<$fh>.
-
-This method must be implemented when subclassing.
-
-=cut
-
-sub parse_analysis;
+sub filter { $_[2] }
 
 =head2 C<finish $session>
 
 Called when the C<$session> finishes.
 
-Defaults to void.
-
-=cut
-
-sub finish { }
+Defaults to clear L<Test::Valgrind::Component/started>.
 
 =head1 SEE ALSO
 
-L<Test::Valgrind>, L<Test::Valgrind::Session>.
+L<Test::Valgrind>, L<Test::Valgrind::Component>, L<Test::Valgrind::Session>.
 
 =head1 AUTHOR
 

Modified: trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool/memcheck.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool/memcheck.pm?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool/memcheck.pm (original)
+++ trunk/libtest-valgrind-perl/lib/Test/Valgrind/Tool/memcheck.pm Thu Oct  1 20:33:59 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 1.02
-
-=cut
-
-our $VERSION = '1.02';
+Version 1.10
+
+=cut
+
+our $VERSION = '1.10';
 
 =head1 DESCRIPTION
 
@@ -21,11 +21,11 @@
 
 =cut
 
-use base qw/Test::Valgrind::Tool::SuppressionsParser Test::Valgrind::Tool/;
+use base qw/Test::Valgrind::Tool/;
 
 =head1 METHODS
 
-This class inherits L<Test::Valgrind::Tool> and L<Test::Valgrind::Tool::SuppressionsParser>.
+This class inherits L<Test::Valgrind::Tool>.
 
 =head2 C<requires_version>
 
@@ -58,8 +58,6 @@
 
  $self->{callers} = $callers;
 
- $self->{twig} = Test::Valgrind::Tool::memcheck::Twig->new(tool => $self);
-
  $self;
 }
 
@@ -73,26 +71,43 @@
 
 sub callers { $_[0]->{callers} }
 
-=head2 C<twig>
-
-Read-only accessor for the underlying L<XML::Twig> parser.
-
-=cut
-
-sub twig { $_[0]->{twig} }
-
 sub suppressions_tag { 'memcheck-' . $_[1]->version }
 
-=head2 C<report_class_analysis $session>
+=head2 C<parser_class $session>
+
+This tool uses a C<Test::Valgrind::Parser::XML::Twig> parser in analysis mode, and a C<Test::Valgrind::Parser::Suppressions::Text> parser in suppressions mode.
+
+=cut
+
+sub parser_class {
+ my ($self, $session) = @_;
+
+ my $class = $session->do_suppressions
+           ? 'Test::Valgrind::Parser::Suppressions::Text'
+           : 'Test::Valgrind::Parser::XML::Twig';
+
+ local $@;
+ eval "require $class";
+
+ return $class;
+}
+
+=head2 C<report_class $session>
 
 This tool emits C<Test::Valgrind::Tool::memcheck::Report> object reports in analysis mode.
 
 =cut
 
-sub report_class_analysis { 'Test::Valgrind::Tool::memcheck::Report' }
+sub report_class {
+ my ($self, $session) = @_;
+
+ $session->do_suppressions ? 'Test::Valgrind::Report::Suppressions'
+                           : 'Test::Valgrind::Tool::memcheck::Report'
+}
 
 sub args {
- my ($self, $sess) = @_;
+ my $self = shift;
+ my ($sess) = @_;
 
  my @args = (
   '--tool=memcheck',
@@ -108,50 +123,14 @@
   push @args, '--xml=yes';
  }
 
- push @args, $self->SUPER::args();
+ push @args, $self->SUPER::args(@_);
 
  return @args;
 }
 
-# We must store the session in ourselves because it's only possible to pass
-# arguments to XML::Twig objects by a global stash.
-
-sub _session { @_ <= 1 ? $_[0]->{_session} : ($_[0]->{_session} = $_[1]) }
-
-sub start {
- my ($self, $sess) = @_;
-
- $self->_croak('This memcheck tool can\'t be run in two sessions at once')
-                                                             if $self->_session;
-
- $self->SUPER::start($sess);
- $self->_session($sess);
-
- return;
-}
-
-sub parse_analysis {
- my ($self, $sess, $fh) = @_;
-
- my $twig = $self->twig;
- $twig->parse($fh);
- $twig->purge;
-
- return;
-}
-
-sub finish {
- my ($self, $sess) = @_;
-
- $self->_session(undef);
- $self->SUPER::finish($sess);
-
- return;
-}
-
 =head1 SEE ALSO
 
-L<Test::Valgrind>, L<Test::Valgrind::Tool>, L<Test::Valgrind::Tool::SuppressionsParser>.
+L<Test::Valgrind>, L<Test::Valgrind::Tool>.
 
 L<XML::Twig>.
 
@@ -186,7 +165,7 @@
 
 use base qw/Test::Valgrind::Report/;
 
-our $VERSION = '1.02';
+our $VERSION = '1.10';
 
 my @kinds = qw/
  InvalidFree
@@ -256,112 +235,3 @@
 
 # End of Test::Valgrind::Tool::memcheck::Report
 
-package Test::Valgrind::Tool::memcheck::Twig;
-
-our $VERSION = '1.02';
-
-use Scalar::Util;
-
-use base qw/XML::Twig Test::Valgrind::Carp/;
-
-BEGIN { XML::Twig->add_options('Stash'); }
-
-my %handlers = (
- '/valgrindoutput/error' => \&handle_error,
-);
-
-sub new {
- my $class = shift;
- $class = ref($class) || $class;
-
- my %args = @_;
- my $stash = delete $args{stash} || { };
-
- my $tool = delete $args{tool};
- $class->_croak('Invalid tool') unless Scalar::Util::blessed($tool)
-                                         and $tool->isa('Test::Valgrind::Tool');
- $stash->{tool} = $tool;
-
- bless $class->XML::Twig::new(
-  elt_class     => __PACKAGE__ . '::Elt',
-  stash         => $stash,
-  twig_roots    => { map { $_ => 1             } keys %handlers },
-  twig_handlers => { map { $_ => $handlers{$_} } keys %handlers },
- ), $class;
-}
-
-sub stash { shift->{Stash} }
-
-sub handle_error {
- my ($twig, $node) = @_;
-
- my $id   = $node->kid('unique')->text;
- my $kind = $node->kid('kind')->text;
-
- my $data;
-
- $data->{what}  = $node->kid('what')->text;
- $data->{stack} = [ map $_->listify_frame,
-                                       $node->kid('stack')->children('frame') ];
-
- for (qw/leakedbytes leakedblocks/) {
-  my $kid = $node->first_child($_);
-  next unless $kid;
-  $data->{$_} = int $kid->text;
- }
-
- if (my $auxwhat = $node->first_child('auxwhat')) {
-  if (my $stack = $auxwhat->next_sibling('stack')) {
-   $data->{auxstack} = [ map $_->listify_frame, $stack->children('frame') ];
-  }
-  $data->{auxwhat} = $auxwhat->text;
- }
-
- if (my $origin = $node->first_child('origin')) {
-  $data->{origwhat}  = $origin->kid('what')->text;
-  $data->{origstack} = [ map $_->listify_frame,
-                                     $origin->kid('stack')->children('frame') ];
- }
-
- my $report = Test::Valgrind::Tool::memcheck::Report->new(
-  kind => $kind,
-  id   => $id,
-  data => $data,
- );
-
- $twig->stash->{tool}->_session->report($report);
-
- $twig->purge;
-}
-
-# End of Test::Valgrind::Tool::memcheck::Twig
-
-package Test::Valgrind::Tool::memcheck::Twig::Elt;
-
-our $VERSION = '1.02';
-
-BEGIN { require XML::Twig; }
-
-use base qw/XML::Twig::Elt Test::Valgrind::Carp/;
-
-sub kid {
- my ($self, $what) = @_;
- my $node = $self->first_child($what);
- $self->_croak("Couldn't get first $what child node") unless $node;
- return $node;
-}
-
-sub listify_frame {
- my ($frame) = @_;
-
- return unless $frame->tag eq 'frame';
-
- return [
-  map {
-   my $x = $frame->first_child($_);
-   $x ? $x->text : undef
-  } qw/ip obj fn dir file line/
- ];
-}
-
-1; # End of Test::Valgrind::Tool::memcheck::Twig::Elt

Modified: trunk/libtest-valgrind-perl/t/80-suppressions.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/t/80-suppressions.t?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/t/80-suppressions.t (original)
+++ trunk/libtest-valgrind-perl/t/80-suppressions.t Thu Oct  1 20:33:59 2009
@@ -3,11 +3,10 @@
 use strict;
 use warnings;
 
-use Test::More tests => 4;
+use Test::More;
 
 use Test::Valgrind::Command;
 use Test::Valgrind::Tool;
-use Test::Valgrind::Action;
 use Test::Valgrind::Session;
 
 my $cmd = Test::Valgrind::Command->new(
@@ -19,9 +18,16 @@
  tool => 'memcheck',
 );
 
-my $sess = Test::Valgrind::Session->new(
+my $sess = eval { Test::Valgrind::Session->new(
  min_version => $tool->requires_version,
-);
+) };
+
+if (my $err = $@) {
+ $err =~ s/^(Empty valgrind candidates list|No appropriate valgrind executable could be found)\s+at.*/$1/;
+ plan skip_all => $err;
+} else {
+ plan tests => 4;
+}
 
 $sess->command($cmd);
 $sess->tool($tool);

Modified: trunk/libtest-valgrind-perl/t/92-pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-valgrind-perl/t/92-pod-coverage.t?rev=45191&op=diff
==============================================================================
--- trunk/libtest-valgrind-perl/t/92-pod-coverage.t (original)
+++ trunk/libtest-valgrind-perl/t/92-pod-coverage.t Thu Oct  1 20:33:59 2009
@@ -34,10 +34,11 @@
 pod_coverage_ok('Test::Valgrind::Command::Perl', $trustparents);
 pod_coverage_ok('Test::Valgrind::Command::PerlScript', $trustparents);
 
+pod_coverage_ok('Test::Valgrind::Parser::Suppressions::Text');
+
 pod_coverage_ok('Test::Valgrind::Report');
 pod_coverage_ok('Test::Valgrind::Session');
 pod_coverage_ok('Test::Valgrind::Suppressions');
 
 pod_coverage_ok('Test::Valgrind::Tool');
-pod_coverage_ok('Test::Valgrind::Tool::SuppressionsParser');
 pod_coverage_ok('Test::Valgrind::Tool::memcheck', $trustparents);




More information about the Pkg-perl-cvs-commits mailing list