Permalink
Browse files

import Devel::Cover 0.44

  • Loading branch information...
1 parent f19d228 commit fd354c7c37dca5603d2be73a8617462d680decd1 @pjcj committed Nov 3, 2004
View
11 CHANGES
@@ -283,9 +283,18 @@ Release 0.42 - 30th April 2004
- Get things running on Windows again.
Release 0.43 - 2nd May 2004
+ - Add +ignore and +select options, and change meaning of -ignore and
+ -select options. This is an interface change.
- Ignore coverage on Devel::Cover's files by default.
- -
- Cover INIT and END blocks more reliably.
- Fix 5.6 on Windows. Well, sort of.
- Add a message in Makefile.PL recommending against using Devel::Cover
on 5.6, especially under Windows.
+
+Release 0.44 - 18th May 2004
+ - Fix get_elapsed, although its result is not used yet.
+ - Recommend 5.8.1 as a minimum.
+ - Replace run Makefile target with text and html.
+ - Fix up gcov2perl.
+ - Fail gracefully when covering a threaded program.
+ - Add DEVEL_COVER_OPTIONS environment variable.
View
@@ -843,7 +843,7 @@ double
get_elapsed()
CODE:
#ifdef HAS_GETTIMEOFDAY
- RETVAL = All;
+ RETVAL = get_elapsed();
#else
RETVAL = 0;
#endif
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.43
+version: 0.44
version_from:
installdirs: site
requires:
View
@@ -19,8 +19,8 @@ use File::Copy;
$| = 1;
-my $Version = "0.43";
-my $Date = "2nd May 2004";
+my $Version = "0.44";
+my $Date = "18th May 2004";
my $Author = 'pjcj@cpan.org';
my @perlbug = ("perlbug", "-a", $Author,
@@ -158,7 +158,7 @@ print "checking for Template.pm version 2.00 ........ ";
$e = <<EOM;
Template.pm 2.00 is required to run the old HTML backends to cover and
-for cpancover. Unless you haev specific requirements this should not be
+for cpancover. Unless you have specific requirements this should not be
a problem, but you will not be able to use these reports until you
install the Template Toolkit, available from CPAN. In the meantime you
may continue to use the rest of Devel::Cover.
@@ -201,12 +201,12 @@ print "checking for Test::Differences.pm ........ ";
$e = <<EOM;
-Test::Differences.pm is to display output from failed tests. Hopefully
-there won't be any failed tests, but if there are you will get output
-that may not be a model of clarity. If you do get test failures and you
-fancy helping me by debugging them, then you might like to consider
-installing Test::Differences. You can download Test::Differences from
-CPAN.
+Test::Differences.pm is used to display output from failed tests.
+Hopefully there won't be any failed tests, but if there are you will get
+output that may not be a model of clarity. If you do get test failures
+and you fancy helping me by debugging them, then you might like to
+consider installing Test::Differences. You can download
+Test::Differences from CPAN.
EOM
@@ -230,19 +230,35 @@ You may well find failing tests.
EOM
-print <<EOM if $] < 5.008;
+if ($] < 5.008)
+{
+ print <<EOM;
Devel::Cover $Version is not fully functional on perl $]. It should
mostly work, but there are some constructs for which coverage will not
-be collected. Perl versions 5.8.1 and above should work better.
+be collected, and you may well encounter bugs which have been fixed in
+subsequent versions of perl. Perl versions 5.8.1 and above should work
+better.
EOM
-print <<EOM if $] < 5.008 && $^O eq "MSWin32";
+ print <<EOM if $^O eq "MSWin32";
And things are even worse under Windows. You may well find random bugs
of various severities.
EOM
+}
+elsif ($] < 5.008001)
+{
+ print <<EOM;
+
+Devel::Cover $Version mostly works on perl $], but you may encounter
+strange behaviours (bugs) which have been fixed in subsequent versions
+of perl. This is particularly true if you are running a threaded perl.
+Perl versions 5.8.1 and above should work better.
+
+EOM
+}
print "\n" x 3;
@@ -333,13 +349,16 @@ ppm : ppd pure_all
Devel-Cover.ppd
TAINT = -T
+COVER_OPTIONS =
_run : pure_all
-\t \$(PERL) \$(TAINT) -Iblib/lib -Iblib/arch -MDevel::Cover=-ignore,blib,-merge,0,`\$(PERL) -e 'qx|grep __COVER__ \$\$ARGV[0]| =~ /__COVER__\\s+criteria\\s+(.*)/; (\$\$c = \$\$1 || "all") =~ s/\\s+/,/g; print "-coverage,\$\$c"' tests/\$(TEST)` tests/\$(TEST) && \\
- \$(PERL) -Mblib cover -report text > \$(TEST).out
+\t \$(PERL) \$(TAINT) -Iblib/lib -Iblib/arch -MDevel::Cover=-merge,0,`\$(PERL) -e 'qx|grep __COVER__ \$\$ARGV[0]| =~ /__COVER__\\s+criteria\\s+(.*)/; (\$\$c = \$\$1 || "all") =~ s/\\s+/,/g; print "-coverage,\$\$c"' tests/\$(TEST)`,\$(COVER_OPTIONS) tests/\$(TEST)
+
+html : _run
+\t \$(PERL) -Mblib cover
-run : _run
-\t \$(PERL) -Mblib cover && \\
+text : html
+\t \$(PERL) -Mblib cover -report text > \$(TEST).out && \\
gvim -d \$(TEST).out
wrun : pure_all
View
2 TODO
@@ -10,7 +10,6 @@
- See if the XS code leaks, and fix it if it does.
- Different criteria for different runs.
- Improve textual output.
-- Add platform and version info to DB.
- Refactor output routines to use common template data.
- Look at time coverage again - collecting for too many ops?
- Separate output for pod coverage, like subroutine coverage.
@@ -29,3 +28,4 @@
- Overhaul test system. Include patt?
- Tests for INIT and END blocks included in required files when the
files are used in some runs.
+- Make all environment variables consistent and document them.
View
@@ -29,7 +29,8 @@ sub get_options
version=s
));
$Options->{version} =
- [ qw( 5.6.1 5.6.2 5.8.0 5.8.1 5.8.2 5.8.3 5.8.4 5.9.2 ) ]
+ [ map { ($_, "$_-thr") }
+ qw( 5.6.1 5.6.2 5.8.0 5.8.1 5.8.2 5.8.3 5.8.4 5.9.2 ) ]
unless @{$Options->{version}};
$Options->{version} =
[ grep eval { !system "perl$_ -v" }, @{$Options->{version}} ];
View
6 cover
@@ -12,9 +12,9 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.43";
+our $VERSION = "0.44";
-use Devel::Cover::DB 0.43;
+use Devel::Cover::DB 0.44;
use Cwd "abs_path";
use Data::Dumper;
@@ -258,7 +258,7 @@ See the BUGS file.
=head1 VERSION
-Version 0.43 - 2nd May 2004
+Version 0.44 - 18th May 2004
=head1 LICENCE
View
@@ -12,9 +12,9 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.43";
+our $VERSION = "0.44";
-use Devel::Cover::DB 0.43;
+use Devel::Cover::DB 0.44;
use Cwd ();
use File::Find ();
@@ -309,7 +309,7 @@ package Devel::Cover::Cpancover::Template::Provider;
use strict;
use warnings;
-our $VERSION = "0.43";
+our $VERSION = "0.44";
use base "Template::Provider";
@@ -345,7 +345,7 @@ $Templates{html} = <<'EOT';
<!--
-This file was generated by Devel::Cover Version 0.43
+This file was generated by Devel::Cover Version 0.44
Devel::Cover is copyright 2001-2004, Paul Johnson (pjcj@cpan.org)
@@ -455,7 +455,7 @@ The following exit values are returned:
=head1 VERSION
-Version 0.43 - 2nd May 2004
+Version 0.44 - 18th May 2004
=head1 LICENCE
View
@@ -12,11 +12,11 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.43";
+our $VERSION = "0.44";
use blib;
-use Devel::Cover::Test 0.43;
+use Devel::Cover::Test 0.44;
my @tests = @ARGV;
View
@@ -12,9 +12,9 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.43";
+our $VERSION = "0.44";
-use Devel::Cover::DB 0.43;
+use Devel::Cover::DB 0.44;
use Getopt::Long;
use Pod::Usage;
@@ -43,40 +43,53 @@ sub get_options
sub add_cover
{
- my ($cover, $file) = @_;
+ my ($file) = @_;
my $f = $file;
$f =~ s/.gcov$//;
+ my %run;
+ $run{collected} = ["statement"];
+ my $structure = Devel::Cover::DB::Structure->new;
+ $structure->add_digest($f, \%run);
+
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}{$.} = [\$_];
+ next unless my ($count, $line) = /(.{9}):\s*(\d+):/;
+ $count =~ s/\s+//g;
+ next if $count eq "-";
+ $count = 0 if $count eq "#####";
+
+ # print "$f:$line - $count\n";
+ push @{$run{count}{$f}{statement}}, $count;
+ $structure->add_statement($f, $line);
}
- close F or die "Can't open $file: $!\n";
+ close F or die "Can't close $file: $!\n";
+
+ my $run = time . ".$$." . sprintf "%05d", rand 2 ** 16;
+ my $db = $Options->{db};
+ my $cover = Devel::Cover::DB->new
+ (
+ base => $db,
+ runs => { $run => \%run },
+ structure => $structure,
+ );
+
+ $db .= "/runs";
+ mkdir $db unless -d $db;
+ $db .= "/$run";
+
+ $cover->{db} = $db;
+
+ print STDOUT __PACKAGE__, ": Writing coverage database to $db\n";
+ $cover->write;
}
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->write($Options->{db});
+ add_cover $_ for @ARGV;
}
main
@@ -89,7 +102,7 @@ gcov2perl - convert gcov files to Devel::Cover databases
=head1 SYNOPSIS
- gcov2perl -h -i -v -db database -merge gcov_files
+ gcov2perl -h -i -v -db database gcov_files
=head1 DESCRIPTION
@@ -100,7 +113,6 @@ Convert gcov files to Devel::Cover databases.
The following command line options are supported:
-db database - specify the database to use
- -merge - merge results with the current database
-h -help - show help
-i -info - show documentation
@@ -123,7 +135,7 @@ Huh?
=head1 VERSION
-Version 0.43 - 2nd May 2004
+Version 0.44 - 18th May 2004
=head1 LICENCE
Oops, something went wrong.

0 comments on commit fd354c7

Please sign in to comment.