Skip to content

Commit

Permalink
Add -gcov option to cover and make it default when using gcc.
Browse files Browse the repository at this point in the history
Remolve unused File::Find from cpancover.
Document how to get XS coverage in gcov2perl.
Bump version to 0.55.
  • Loading branch information
pjcj committed Sep 21, 2005
1 parent 14838f5 commit 64966b3
Show file tree
Hide file tree
Showing 40 changed files with 187 additions and 112 deletions.
5 changes: 5 additions & 0 deletions CHANGES
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion META.yml
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions Makefile.PL
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions TODO
Expand Up @@ -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.
Expand Down
49 changes: 44 additions & 5 deletions cover
Expand Up @@ -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;
Expand All @@ -30,6 +32,7 @@ my $Options =
annotation => [],
coverage => [],
delete => 0,
gcov => $Config{gccversion},
ignore => [],
ignore_re => [],
select => [],
Expand Down Expand Up @@ -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";
}

Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -357,7 +396,7 @@ See the BUGS file.
=head1 VERSION
Version 0.54 - 13th September 2005
Version 0.55 - 22nd September 2005
=head1 LICENCE
Expand Down
11 changes: 5 additions & 6 deletions cpancover
Expand Up @@ -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;
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions create_gold
Expand Up @@ -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;

Expand Down
39 changes: 35 additions & 4 deletions gcov2perl
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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:
Expand All @@ -136,7 +167,7 @@ Huh?
=head1 VERSION
Version 0.54 - 13th September 2005
Version 0.55 - 22nd September 2005
=head1 LICENCE
Expand Down
8 changes: 4 additions & 4 deletions lib/Devel/Cover.pm
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/Devel/Cover/Annotation/Random.pm
Expand Up @@ -10,7 +10,7 @@ package Devel::Cover::Annotation::Random;
use strict;
use warnings;

our $VERSION = "0.54";
our $VERSION = "0.55";

use Getopt::Long;

Expand Down Expand Up @@ -103,7 +103,7 @@ Huh?
=head1 VERSION
Version 0.54 - 13th September 2005
Version 0.55 - 22nd September 2005
=head1 LICENCE
Expand Down
4 changes: 2 additions & 2 deletions lib/Devel/Cover/Annotation/Svk.pm
Expand Up @@ -10,7 +10,7 @@ package Devel::Cover::Annotation::Svk;
use strict;
use warnings;

our $VERSION = "0.54";
our $VERSION = "0.55";

use Getopt::Long;

Expand Down Expand Up @@ -130,7 +130,7 @@ Huh?
=head1 VERSION
Version 0.54 - 13th September 2005
Version 0.55 - 22nd September 2005
=head1 LICENCE
Expand Down
4 changes: 2 additions & 2 deletions lib/Devel/Cover/Branch.pm
Expand Up @@ -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";

Expand Down Expand Up @@ -104,7 +104,7 @@ Huh?
=head1 VERSION
Version 0.54 - 13th September 2005
Version 0.55 - 22nd September 2005
=head1 LICENCE
Expand Down
4 changes: 2 additions & 2 deletions lib/Devel/Cover/Condition.pm
Expand Up @@ -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";

Expand Down Expand Up @@ -84,7 +84,7 @@ Huh?
=head1 VERSION
Version 0.54 - 13th September 2005
Version 0.55 - 22nd September 2005
=head1 LICENCE
Expand Down
4 changes: 2 additions & 2 deletions lib/Devel/Cover/Condition_and_2.pm
Expand Up @@ -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";

Expand Down Expand Up @@ -46,7 +46,7 @@ Huh?
=head1 VERSION
Version 0.54 - 13th September 2005
Version 0.55 - 22nd September 2005
=head1 LICENCE
Expand Down

0 comments on commit 64966b3

Please sign in to comment.