Permalink
Browse files

Add -gcov option to cover and make it default when using gcc.

Remolve unused File::Find from cpancover.
Document how to get XS coverage in gcov2perl.
Bump version to 0.55.
  • Loading branch information...
1 parent 14838f5 commit 64966b39354b654d4e284161cd174c6d952f882f @pjcj committed Sep 21, 2005
View
@@ -1,5 +1,10 @@
Devel::Cover.pm history
+Release 0.54 - 22nd September 2005
+ - Add -gcov option to cover and make it default when using gcc.
+ - Remolve unused File::Find from cpancover.
+ - Document how to get XS coverage in gcov2perl.
+
Release 0.54 - 13th September 2005
- Make html_basic prettier.
- Fix pod coverage percentages.
View
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Devel-Cover
-version: 0.54
+version: 0.55
version_from:
installdirs: site
requires:
View
@@ -19,8 +19,8 @@ use File::Copy;
$| = 1;
-my $Version = "0.54";
-my $Date = "13th September 2005";
+my $Version = "0.55";
+my $Date = "22nd September 2005";
my $Author = 'pjcj@cpan.org';
my @perlbug = ("perlbug", "-a", $Author,
View
1 TODO
@@ -17,6 +17,7 @@
- Allow thresholds to be customisable in HTML output.
- Move HTML version and platform info to main page and allow for multiples.
- Add -db option to cover.
+ - Diff functionality.
- Bugs:
- Work with memoize. Is this still a problem?
- See if the XS code leaks, and fix it if it does.
View
49 cover
@@ -12,12 +12,14 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
-use Devel::Cover::DB 0.54;
+use Devel::Cover::DB 0.55;
+use Config;
use Cwd "abs_path";
use Data::Dumper;
+use File::Find ();
use File::Path;
use FindBin '$Bin';
use Getopt::Long;
@@ -30,6 +32,7 @@ my $Options =
annotation => [],
coverage => [],
delete => 0,
+ gcov => $Config{gccversion},
ignore => [],
ignore_re => [],
select => [],
@@ -155,16 +158,49 @@ sub main
if ($Options->{test})
{
+ # TODO - something for Module::Build
+ # TODO - make this a little robust
delete_db($dbname, @ARGV);
local $ENV{ -d "t" ? "HARNESS_PERL_SWITCHES" : "PERL5OPT" } =
"-MDevel::Cover";
my $test = "make test";
if ($Options->{gcov})
{
+ my $c = "make clean";
+ print STDERR "cover: running $c\n";
+ system $c;
+ rename "Makefile.old" => "Makefile";
my $o = "-fprofile-arcs\\ -ftest-coverage";
$test .= " CCFLAGS=-O0\\ $o OTHERLDFLAGS=$o";
}
+ print STDERR "cover: running $test\n";
system $test;
+ if ($Options->{gcov})
+ {
+ my $gc = sub
+ {
+ return unless /\.xs$/;
+ my $c = "gcov $_";
+ print STDERR "cover: running $c\n";
+ system $c;
+ };
+ File::Find::find($gc, ".");
+ my @gc;
+ my $gp = sub
+ {
+ return unless /\.gcov$/;
+ my $xs = $_;
+ return if $xs =~ s/\.c\.gcov$/.xs.gcov/ && -e $xs;
+ push @gc, $_;
+ };
+ File::Find::find($gp, ".");
+ if (@gc)
+ {
+ my $c = "gcov2perl @gc";
+ print STDERR "cover: running $c\n";
+ system $c;
+ }
+ }
$Options->{report} ||= "html";
}
@@ -273,7 +309,7 @@ cover - report coverage statistics
-write [db] -delete -dump_db
-silent
-coverage criterion
- -test
+ -test -gcov
-add_uncoverable_point -delete_uncoverable_point
-clean_uncoverable_points -uncoverable_file
[report specific options]
@@ -315,6 +351,7 @@ The following command line options are supported:
-coverage criterion - report on criterion (default all available)
-test - drop database(s) and run make test (default off)
+ -gcov - run gcov to cover XS code (default on if using gcc)
other options specific to the report
@@ -335,7 +372,9 @@ Specify -coverage options to report on specific criteria. By default
all available information on all criteria in all files will be reported.
The -test option will delete the databases and run make test to generate
-new coverage data before reporting on it.
+new coverage data before reporting on it. The -gcov option will try to
+run gcov on any XS code. This requires that you are using gcc of
+course. If you are this option will be turned on by default.
=head1 EXIT STATUS
@@ -357,7 +396,7 @@ See the BUGS file.
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
View
@@ -12,12 +12,11 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
-use Devel::Cover::DB 0.54;
+use Devel::Cover::DB 0.55;
use Cwd ();
-use File::Find ();
use Getopt::Long;
use Pod::Usage;
use Template 2.00;
@@ -333,7 +332,7 @@ package Devel::Cover::Cpancover::Template::Provider;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
use base "Template::Provider";
@@ -369,7 +368,7 @@ $Templates{html} = <<'EOT';
<!--
-This file was generated by Devel::Cover Version 0.54
+This file was generated by Devel::Cover Version 0.55
Devel::Cover is copyright 2001-2004, Paul Johnson (pjcj@cpan.org)
@@ -479,7 +478,7 @@ The following exit values are returned:
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
View
@@ -12,14 +12,14 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
use blib;
use Config;
exit if $Config{useithreads};
-use Devel::Cover::Test 0.54;
+use Devel::Cover::Test 0.55;
my @tests = @ARGV;
View
@@ -12,9 +12,9 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
-use Devel::Cover::DB 0.54;
+use Devel::Cover::DB 0.55;
use Getopt::Long;
use Pod::Usage;
@@ -83,7 +83,7 @@ sub add_cover
$cover->{db} = $db;
- print STDOUT __PACKAGE__, ": Writing coverage database to $db\n";
+ print STDOUT "gcov2perl: Writing coverage database to $db\n";
$cover->write;
}
@@ -119,6 +119,37 @@ The following command line options are supported:
-i -info - show documentation
-v -version - show version
+=head1 DETAILS
+
+To obtain coverage of XS files they must first be compiled with the appropriare
+options. In a standard Makefile environment, such as that created by
+ExtUtils::MakeMaker, this can be accomplished with the command:
+
+ HARNESS_PERL_SWITCHES=-MDevel::Cover make test \
+ CCFLAGS=-O0\ -fprofile-arcs\ -ftest-coverage \
+ OTHERLDFLAGS=-fprofile-arcs\ -ftest-coverage
+
+If you have already built your object files it may be necessary to run make
+clean first, or to find some other way to ensure that they get rebuilt with the
+options gcov requires.
+
+Now the code coverage data has been collected C<gcov> needs to be run:
+
+ gcov Mylib.xs
+
+This will create one or more gcov files on which you can run C<gcov2perl>:
+
+ gcov2perl Mylib.xs.gcov
+
+Finally, C<cover> should be run as usual with any options required:
+
+ cover
+
+If you are running everything with standard options, you can do all this with
+one command:
+
+ cover -test
+
=head1 EXIT STATUS
The following exit values are returned:
@@ -136,7 +167,7 @@ Huh?
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
View
@@ -10,13 +10,13 @@ package Devel::Cover;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
use DynaLoader ();
our @ISA = "DynaLoader";
-use Devel::Cover::DB 0.54;
-use Devel::Cover::Inc 0.54;
+use Devel::Cover::DB 0.55;
+use Devel::Cover::Inc 0.55;
use B qw( class ppname main_cv main_start main_root walksymtable OPf_KIDS );
use B::Debug;
@@ -1350,7 +1350,7 @@ See the BUGS file. And the TODO file.
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
@@ -10,7 +10,7 @@ package Devel::Cover::Annotation::Random;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
use Getopt::Long;
@@ -103,7 +103,7 @@ Huh?
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
@@ -10,7 +10,7 @@ package Devel::Cover::Annotation::Svk;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
use Getopt::Long;
@@ -130,7 +130,7 @@ Huh?
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
@@ -10,7 +10,7 @@ package Devel::Cover::Branch;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
use base "Devel::Cover::Criterion";
@@ -104,7 +104,7 @@ Huh?
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
@@ -10,7 +10,7 @@ package Devel::Cover::Condition;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
use base "Devel::Cover::Branch";
@@ -84,7 +84,7 @@ Huh?
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
@@ -10,7 +10,7 @@ package Devel::Cover::Condition_and_2;
use strict;
use warnings;
-our $VERSION = "0.54";
+our $VERSION = "0.55";
use base "Devel::Cover::Condition";
@@ -46,7 +46,7 @@ Huh?
=head1 VERSION
-Version 0.54 - 13th September 2005
+Version 0.55 - 22nd September 2005
=head1 LICENCE
Oops, something went wrong.

0 comments on commit 64966b3

Please sign in to comment.