Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

import Devel::Cover 0.14

  • Loading branch information...
commit 2152f1e5413e380d06f1ad0d026ea659314a8ece 1 parent f125fb8
@pjcj authored
View
5 CHANGES
@@ -61,3 +61,8 @@ Release 0.12 - 14th October 2001
Release 0.13 - 14th October 2001
- Forgot to allow for lack of Pod::Coverage in Devel::Cover::Pod.pm.
+
+Release 0.14 - 28th February 2002
+ - Add a workaround for an AUTOLOAD bug in bleadperl.
+ - Add gcov2perl program to convert gcov files to Devel::Cover databases.
+ - Get rid of // comments in xs file.
View
22 Cover.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -12,11 +12,11 @@ use warnings;
use DynaLoader ();
-use Devel::Cover::DB 0.13;
-use Devel::Cover::Inc 0.13;
+use Devel::Cover::DB 0.14;
+use Devel::Cover::Inc 0.14;
our @ISA = qw( DynaLoader );
-our $VERSION = "0.13";
+our $VERSION = "0.14";
use B qw( class ppname main_root main_start main_cv svref_2object OPf_KIDS );
use B::Debug;
@@ -65,9 +65,9 @@ sub import
/^-merge/ && do { $Merge = shift; next };
/^-profile/ && do { $Profiling = shift; next };
/^-summary/ && do { $Summary = shift; next };
- /^-ignore/ && do { push @Ignore, shift while $_[0] !~ /^-/; next };
- /^[-+]inc/ && do { push @Inc, shift while $_[0] !~ /^-/; next };
- /^-select/ && do { push @Select, shift while $_[0] !~ /^-/; next };
+ /^-ignore/ && do { push @Ignore, shift while $_[0] !~ /^[-+]/; next };
+ /^[-+]inc/ && do { push @Inc, shift while $_[0] !~ /^[-+]/; next };
+ /^-select/ && do { push @Select, shift while $_[0] !~ /^[-+]/; next };
warn __PACKAGE__ . ": Unknown option $_ ignored\n";
}
}
@@ -398,10 +398,14 @@ there may be some statements which are no reported. Pod coverage comes
from Pod::Coverage. Coverage data for other metrics are collected, but
not reported. Coverage data for some metrics are not yet collected.
+The B<gcov2perl> program can be used to convert gcov files to
+Devel::Cover databases.
+
You may find that the results don't match your expectations. I would
imagine that at least one of them is wrong.
Requirements:
+
Perl 5.6.1 or 5.7.1.
The ability to compile XS extensions.
Pod::Coverage if you want pod coverage.
@@ -440,11 +444,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
10 Cover.xs
@@ -1,5 +1,5 @@
/*
- * Copyright 2001, Paul Johnson (pjcj@cpan.org)
+ * Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
*
* This software is free. It is licensed under the same terms as Perl itself.
*
@@ -126,7 +126,7 @@ runops_cover(pTHX)
if (!cover_hv) cover_hv = newHV();
addr.ch[sizeof(PL_op)] = '\0';
- // fprintf(stderr, "runops_cover\n");
+ /* fprintf(stderr, "runops_cover\n"); */
while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX)))
{
if (covering)
@@ -158,7 +158,7 @@ runops_cover(pTHX)
static int
runops_orig(pTHX)
{
- // fprintf(stderr, "runops_orig\n");
+ /* fprintf(stderr, "runops_orig\n"); */
while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX)))
{
PERL_ASYNC_CHECK();
@@ -176,7 +176,7 @@ void
set_cover(flag)
int flag
PPCODE:
- // fprintf(stderr, "Cover set to %d\n", flag);
+ /* fprintf(stderr, "Cover set to %d\n", flag); */
PL_runops = ((covering = flag) || profiling)
? runops_cover
: runops_orig;
@@ -185,7 +185,7 @@ void
set_profile(flag)
int flag
PPCODE:
- // fprintf(stderr, "Cover set to %d\n", flag);
+ /* fprintf(stderr, "Cover set to %d\n", flag); */
PL_runops = ((profiling = flag) || covering)
? runops_cover
: runops_orig;
View
8 Cover/Condition.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -12,7 +12,7 @@ use warnings;
use base "Devel::Cover::Criterion";
-our $VERSION = "0.13";
+our $VERSION = "0.14";
sub covered { scalar grep $_, @{$_[0]} }
sub total { scalar @{$_[0]} }
@@ -77,11 +77,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
10 Cover/Criterion.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -10,7 +10,7 @@ package Devel::Cover::Criterion;
use strict;
use warnings;
-our $VERSION = "0.13";
+our $VERSION = "0.14";
sub new
{
@@ -29,7 +29,7 @@ sub calculate_percentage
{
my $class = shift;
my ($db, $s) = @_;
- $s->{percentage} = $s->{covered} * 100 / $s->{total};
+ $s->{percentage} = $s->{total} ? $s->{covered} * 100 / $s->{total} : 100;
}
1
@@ -66,11 +66,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
28 Cover/DB.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -10,18 +10,18 @@ package Devel::Cover::DB;
use strict;
use warnings;
-use Devel::Cover::DB::File 0.13;
-use Devel::Cover::Criterion 0.13;
-use Devel::Cover::Statement 0.13;
-use Devel::Cover::Condition 0.13;
-use Devel::Cover::Pod 0.13;
-use Devel::Cover::Time 0.13;
+use Devel::Cover::DB::File 0.14;
+use Devel::Cover::Criterion 0.14;
+use Devel::Cover::Statement 0.14;
+use Devel::Cover::Condition 0.14;
+use Devel::Cover::Pod 0.14;
+use Devel::Cover::Time 0.14;
use Carp;
use Data::Dumper;
use File::Path;
-our $VERSION = "0.13";
+our $VERSION = "0.14";
my $DB = "cover.2"; # Version 2 of the database.
@@ -273,7 +273,7 @@ sub cover
{
for (@$line)
{
- die "<$_>" unless ref $_;
+ die "<$crit:$_>" unless ref $_;
bless $_, "Devel::Cover::$c";
}
}
@@ -324,8 +324,10 @@ sub cover
{
*Devel::Cover::DB::File::AUTOLOAD = sub
{
- my $func = $Devel::Cover::DB::AUTOLOAD;
- # print "autoloading $func\n";
+ # Work around a change in bleadperl from 12251 to 14899.
+ my $func = $Devel::Cover::DB::AUTOLOAD || $::AUTOLOAD;
+
+ # print STDERR "autoloading <$func>\n";
(my $f = $func) =~ s/^.*:://;
carp "Undefined subroutine $f called"
unless grep { $_ eq $f }
@@ -478,11 +480,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
20 Cover/DB/File.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -10,13 +10,13 @@ package Devel::Cover::DB::File;
use strict;
use warnings;
-use Devel::Cover::Criterion 0.13;
-use Devel::Cover::Statement 0.13;
-use Devel::Cover::Condition 0.13;
-use Devel::Cover::Pod 0.13;
-use Devel::Cover::Time 0.13;
+use Devel::Cover::Criterion 0.14;
+use Devel::Cover::Statement 0.14;
+use Devel::Cover::Condition 0.14;
+use Devel::Cover::Pod 0.14;
+use Devel::Cover::Time 0.14;
-our $VERSION = "0.13";
+our $VERSION = "0.14";
sub calculate_summary
{
@@ -28,8 +28,6 @@ sub calculate_summary
for my $criterion ($self->items)
{
next unless $options->{$criterion};
- # use Data::Dumper;
- # print STDERR $criterion, " ", Dumper $self->$criterion();
for my $location ($self->$criterion()->locations)
{
for my $cover (@$location)
@@ -84,11 +82,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
4 Cover/Op.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -10,7 +10,7 @@ package Devel::Cover::Op;
use strict;
use warnings;
-our $VERSION = "0.13";
+our $VERSION = "0.14";
use Devel::Cover qw( -inc B -indent 1 -details 1 );
use B::Concise qw( set_style add_callback );
View
8 Cover/Pod.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -14,7 +14,7 @@ use base "Devel::Cover::Criterion";
BEGIN { eval "use Pod::Coverage 0.06" } # We'll use this if it is available.
-our $VERSION = "0.13";
+our $VERSION = "0.14";
sub covered { $_[0]->[0] ? 1 : 0 }
sub total { 1 }
@@ -78,11 +78,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
8 Cover/Statement.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -12,7 +12,7 @@ use warnings;
use base "Devel::Cover::Criterion";
-our $VERSION = "0.13";
+our $VERSION = "0.14";
sub covered { $_[0]->[0] }
sub total { 1 }
@@ -74,11 +74,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
8 Cover/Time.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -12,7 +12,7 @@ use warnings;
use base "Devel::Cover::Criterion";
-our $VERSION = "0.13";
+our $VERSION = "0.14";
sub covered { $_[0]->[0] }
sub total { 1 }
@@ -69,11 +69,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
4 Cover/Tutorial.pod
@@ -163,11 +163,11 @@ basis for future research.
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
1  MANIFEST
@@ -19,5 +19,6 @@ t/t1.t
t/T1.pm
t/t2.t
cover
+gcov2perl
Cover/Tutorial.pod
session.vim
View
8 Makefile.PL
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -16,8 +16,8 @@ use ExtUtils::MakeMaker;
$| = 1;
-my $Version = "0.13";
-my $Date = "14th October 2001";
+my $Version = "0.14";
+my $Date = "28th February 2002";
my $Author = 'pjcj@cpan.org';
my @perlbug = ("perlbug", "-a", $Author,
@@ -33,7 +33,7 @@ close M or die "Cannot close MANIFEST: $!";
open I, ">Cover/Inc.pm" or die "Cannot open Cover/Inc.pm: $!";
print I <<"EOI";
-# Copyright 2001, Paul Johnson (pjcj\@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj\@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
View
10 README
@@ -20,9 +20,15 @@ DESCRIPTION
Pod::Coverage. Coverage data for other metrics are collected, but not
reported. Coverage data for some metrics are not yet collected.
+ The gcov2perl program can be used to convert gcov files to Devel::Cover
+ databases.
+
You may find that the results don't match your expectations. I would
imagine that at least one of them is wrong.
- Requirements: Perl 5.6.1 or 5.7.1. The ability to compile XS extensions.
- Pod::Coverage if you want pod coverage.
+ Requirements:
+
+ Perl 5.6.1 or 5.7.1.
+ The ability to compile XS extensions.
+ Pod::Coverage if you want pod coverage.
View
20 cover
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -12,13 +12,13 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.13";
+our $VERSION = "0.14";
-use Devel::Cover::DB 0.13;
-use Devel::Cover::Statement 0.13;
-use Devel::Cover::Condition 0.13;
-use Devel::Cover::Pod 0.13;
-use Devel::Cover::Time 0.13;
+use Devel::Cover::DB 0.14;
+use Devel::Cover::Statement 0.14;
+use Devel::Cover::Condition 0.14;
+use Devel::Cover::Pod 0.14;
+use Devel::Cover::Time 0.14;
use Getopt::Long;
BEGIN { eval "use Pod::Coverage" } # We'll use this if it is available.
@@ -284,7 +284,7 @@ cover - report coverage statistics
=head1 SYNOPSIS
- cover [-hiv] -summary -details -html coverage_database
+ cover -h -i -v -summary -details -html coverage_database
=head1 DESCRIPTION
@@ -329,11 +329,11 @@ Huh?
=head1 VERSION
-Version 0.13 - 14th October 2001
+Version 0.14 - 28th February 2002
=head1 LICENCE
-Copyright 2001, Paul Johnson (pjcj@cpan.org)
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
This software is free. It is licensed under the same terms as Perl itself.
View
139 gcov2perl
@@ -0,0 +1,139 @@
+#!/usr/local/bin/perl
+
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
+
+# This software is free. It is licensed under the same terms as Perl itself.
+
+# The latest version of this software should be available from my homepage:
+# http://www.pjcj.net
+
+require 5.6.1;
+
+use strict;
+use warnings;
+
+use Devel::Cover::DB 0.14;
+
+our $VERSION = "0.14";
+
+use Getopt::Long;
+
+my $Options =
+{
+ db => "cover_db",
+ indent => 0,
+ merge => 1,
+};
+
+sub get_options
+{
+ die "Bad option" unless
+ GetOptions($Options, # Store the options in the Options hash.
+ qw(
+ db=s
+ help|h!
+ indent=i
+ info|i!
+ merge!
+ version|v!
+ ));
+ print "$0 version $VERSION\n" and exit 0 if $Options->{version};
+}
+
+sub add_cover
+{
+ my ($cover, $file) = @_;
+
+ my $f = $file;
+ $f =~ s/.gcov$//;
+
+ open F, $file or die "Can't open $file: $!\n";
+ while (<F>)
+ {
+ $_ = substr $_, 0, 16;
+ s/\s+//g;
+ $_ = 0 if $_ eq "######";
+ next if !length || /\D/;
+ $cover->{$f}{statement}{$.} = [[$_]];
+ }
+ close F or die "Can't open $file: $!\n";
+}
+
+sub main
+{
+ get_options;
+
+ my $cover = {};
+
+ for my $file (@ARGV)
+ {
+ add_cover $cover, $file;
+ }
+
+ my $db = Devel::Cover::DB->new(cover => $cover);
+ my $existing;
+ eval { $existing = Devel::Cover::DB->new(db => $Options->{db})
+ if $Options->{merge} };
+ $db->merge($existing) if $existing;
+ $db->indent($Options->{indent});
+ $db->write($Options->{db});
+}
+
+main
+
+__END__
+
+=head1 NAME
+
+gcov2perl - convert gcov files to Devel::Cover databases
+
+=head1 SYNOPSIS
+
+ gcov2perl -h -i -v -db database -merge -indent gcov_files
+
+=head1 DESCRIPTION
+
+Convert gcov files to Devel::Cover databases.
+
+=head1 OPTIONS
+
+The following command line options are supported:
+
+ -db database - specify the database to use
+ -merge - merge results with the current database
+ -indent - Data::Dumper indent level to use
+
+ -h -help - show help
+ -i -info - show documentation
+ -v -version - show version
+
+=head1 EXIT STATUS
+
+The following exit values are returned:
+
+0 All files converted successfully
+
+>0 An error occurred.
+
+=head1 SEE ALSO
+
+ Dvel::Cover
+
+=head1 BUGS
+
+Huh?
+
+=head1 VERSION
+
+Version 0.14 - 28th February 2002
+
+=head1 LICENCE
+
+Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
+
+This software is free. It is licensed under the same terms as Perl itself.
+
+The latest version of this software should be available from my homepage:
+http://www.pjcj.net
+
+=cut
View
2  session.vim
@@ -5,7 +5,9 @@ e Cover/DB.pm
e Cover/Op.pm
e Cover.xs
e cover
+e gcov2perl
e CHANGES
e TODO
e MANIFEST
+e BUGS
e #1
View
4 t/Compare.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -10,7 +10,7 @@ package Compare;
use strict;
use warnings;
-our $VERSION = "0.13";
+our $VERSION = "0.14";
sub compare
{
View
2  t/T1.pm
@@ -1,4 +1,4 @@
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
View
6 t/t1.t
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -10,8 +10,8 @@
use strict;
use warnings;
-use Devel::Cover::DB 0.13;
-use Devel::Cover 0.13 qw( -db t1 -select T1 -indent 1 -merge 0 );
+use Devel::Cover::DB 0.14;
+use Devel::Cover 0.14 qw( -db t1 -select T1 -indent 1 -merge 0 );
use Test;
View
6 t/t2.t
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl
-# Copyright 2001, Paul Johnson (pjcj@cpan.org)
+# Copyright 2001-2002, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
@@ -10,8 +10,8 @@
use strict;
use warnings;
-use Devel::Cover::DB 0.13;
-use Devel::Cover 0.13 qw( -db t2 +inc blib -indent 1 -merge 0 );
+use Devel::Cover::DB 0.14;
+use Devel::Cover 0.14 qw( -db t2 +inc blib -indent 1 -merge 0 );
use Test;
Please sign in to comment.
Something went wrong with that request. Please try again.