Permalink
Browse files

import Devel::Cover 0.29

  • Loading branch information...
1 parent cb76b0d commit ccdbd3648318be3cd79993c801931067ed94b6dd @pjcj committed Nov 3, 2004
View
10 CHANGES
@@ -166,3 +166,13 @@ Release 0.28 - 1st December 2003
- Pass unknown cover options to the formatter and remove -option.
- Specify the output directory for HTML.
- Search up directory trees for modules.
+
+Release 0.29 - 19th December 2003
+ - Merge data from files with identical MD5 checksums (Arthur Bergman).
+ - Add do test.
+ - Handle $x || return.
+ - Keep cover -delete happy when there is no existing database.
+ - In cover, make -file a glob and add -exclude.
+ - Watch for coverage options being set in cover (PERL5OPT set?).
+ - Fix up html_basic and html_subtle.
+ - Make 5.6.x builds a bit quieter.
View
@@ -345,7 +345,9 @@ static void cover_logop()
if (right->op_type == OP_NEXT ||
right->op_type == OP_LAST ||
right->op_type == OP_REDO ||
- right->op_type == OP_GOTO)
+ right->op_type == OP_REDO ||
+ right->op_type == OP_GOTO ||
+ right->op_type == OP_RETURN)
{
/*
* If the right side of the op is a branch, we don't
@@ -433,10 +435,10 @@ static void cover_time()
ch = get_key(Profiling_op);
count = hv_fetch(Times, ch, ch_sz, 1);
c = (SvTRUE(*count) ? SvIV(*count) : 0) +
-#if 0
- Profiling == 1 ? cpu() : elapsed();
-#else
+#if defined HAS_GETTIMEOFDAY
elapsed();
+#else
+ cpu();
#endif
sv_setiv(*count, c);
NDEB(D(L, "Adding time: sum %d at %p\n", c, Profiling_op));
@@ -487,8 +489,10 @@ static int runops_cover(pTHX)
Pending_conditionals = newHV();
}
-#if CAN_PROFILE
+#if defined HAS_GETTIMEOFDAY
elapsed();
+#elif defined HAS_TIMES
+ cpu();
#endif
for (;;)
@@ -744,7 +748,7 @@ coverage()
ST(0) = &PL_sv_undef;
BOOT:
- PL_runops = runops_orig;
+ /* PL_runops = runops_orig; */
/* PL_savebegin = TRUE; */
/* PL_savecheck = TRUE; */
/* PL_saveinit = TRUE; */
View
@@ -1,12 +1,12 @@
# 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.28
+version: 0.29
version_from:
installdirs: site
requires:
Digest::MD5: 0
Storable: 0
distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.21
+generated_by: ExtUtils::MakeMaker version 6.21_01
View
@@ -19,8 +19,8 @@ use ExtUtils::Manifest "maniread";
$| = 1;
-my $Version = "0.28";
-my $Date = "1st December 2003";
+my $Version = "0.29";
+my $Date = "19th December 2003";
my $Author = 'pjcj@cpan.org';
my @perlbug = ("perlbug", "-a", $Author,
@@ -74,7 +74,7 @@ opendir D, "tests" or die "Cannot opendir tests: $!";
for my $t (readdir D)
{
next unless -f "tests/$t";
- next if $t =~ /\.(pm|version|org|bak)$/;
+ next if $t =~ /\.(pm|pl|version|org|bak)$/;
next if $t =~ /~$/;
open T, ">t/a$t.t" or die "Cannot open t/a$t.t: $!";
print T <<EOT;
@@ -292,8 +292,10 @@ run : _run
\t \$(PERL) -Mblib cover && \\
gvim -d \$(TEST).out
+__COVER_GOLDEN_VERSION ?= $test_version
+
diff : _run
-\t gvim -d -font 8x13 test_output/cover/\$(TEST).$test_version \$(TEST).out
+\t gvim -d -font 8x13 test_output/cover/\$(TEST).\$(__COVER_GOLDEN_VERSION) \$(TEST).out
gold : pure_all
\t \$(PERL) create_gold \$(TEST)
View
2 TODO
@@ -19,3 +19,5 @@
- Merge data from dynamically created subs.
- Separate output for pod coverage, like subroutine coverage.
- Extend cpancover so people can upload databases.
+- allow thresholds to be customisable in HTML output.
+- Fix up html_basic and html_subtle for subs.
View
71 cover
@@ -12,22 +12,24 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.28";
+our $VERSION = "0.29";
-use Devel::Cover::DB 0.28;
+use Devel::Cover::DB 0.29;
use Cwd "abs_path";
+use Data::Dumper;
use File::Path;
use Getopt::Long;
use Pod::Usage;
my $Options =
{
- coverage => [],
- delete => 0,
- file => [],
- report => "",
- summary => 1,
+ coverage => [],
+ delete => 0,
+ exclude => [],
+ file => [],
+ report => "",
+ summary => 1,
};
sub get_options
@@ -43,6 +45,8 @@ sub get_options
qw(
coverage=s
delete!
+ dump_db!
+ exclude=s
help|h!
file=s
info|i!
@@ -56,6 +60,18 @@ sub get_options
sub main
{
+ if ($INC{"Devel/Cover.pm"})
+ {
+ my $err = "$0 shouldn't be run with coverage turned on.\n";
+ eval
+ {
+ require POSIX;
+ print STDERR $err;
+ POSIX::_exit(1);
+ };
+ die $err;
+ }
+
get_options;
my $format = "Devel::Cover::Report::\u$Options->{report}";
@@ -77,7 +93,8 @@ sub main
pod2usage(-exitval => 0, -verbose => 2) if $Options->{info};
my $dbname = Cwd::abs_path(@ARGV ? shift @ARGV : "cover_db");
- die "Can't open database $dbname\n" unless -d $dbname;
+ die "Can't open database $dbname\n"
+ if !$Options->{delete} && !-d $dbname;
$Options->{outputdir} = $dbname unless exists $Options->{outputdir};
my $od = Cwd::abs_path($Options->{outputdir});
@@ -89,10 +106,11 @@ sub main
for my $del ($dbname, @ARGV)
{
print "Deleting database $del\n";
+ next unless -d $del;
my $db = Devel::Cover::DB->new(db => $del);
$db->delete;
}
- exit 0;
+ exit 0
}
print "Reading database from $dbname\n";
@@ -105,6 +123,15 @@ sub main
$db->merge($mdb);
}
+ if ($Options->{dump_db})
+ {
+ my $d = Data::Dumper->new([$db], ["db"]);
+ $d->Indent(1);
+ $d->Sortkeys(1) if $] >= 5.008;
+ print $d->Dump;
+ exit 0
+ }
+
if (exists $Options->{write})
{
$dbname = $Options->{write} if length $Options->{write};
@@ -126,7 +153,11 @@ sub main
return unless length $Options->{report};
- @{$Options->{file}} = sort $db->cover->items unless @{$Options->{file}};
+ my %f = map { $_ => 1 } (@{$Options->{file}}
+ ? map glob, @{$Options->{file}}
+ : $db->cover->items);
+ delete @f{map glob, @{$Options->{exclude}}};
+ @{$Options->{file}} = sort grep exists $db->{summary}{$_}, keys %f;
$format->report($db, $Options)
}
@@ -142,8 +173,9 @@ cover - report coverage statistics
=head1 SYNOPSIS
cover -help -info -version
- -summary -report report_format
- -file filename -write [db] -delete
+ -summary -report report_format -outputdir dir
+ -file filename -exclude filname
+ -write [db] -delete -dump_db
-coverage criterion
[report specific options]
coverage_database [coverage_database ...]
@@ -168,12 +200,15 @@ The following command line options are supported:
-i -info - show documentation
-v -version - show version
- -summary - give summary report (default on)
- -report report_format - report format required (default html)
+ -summary - give summary report (default on)
+ -report report_format - report format required (default html)
+ -outputdir - directory for output (default db)
- -file filename - only report on the file (default all)
- -write [db] - write the merged database (default off)
- -delete - drop database(s) (default off)
+ -file filename - only report on the file (default all)
+ -exclude filename - don't report on the file (default none)
+ -write [db] - write the merged database (default off)
+ -delete - drop database(s) (default off)
+ -dump_db - dump database(s) (for debugging) (default off)
-coverage criterion - report on criterion (default all available)
@@ -215,7 +250,7 @@ See the BUGS file.
=head1 VERSION
-Version 0.28 - 1st December 2003
+Version 0.29 - 19th December 2003
=head1 LICENCE
View
@@ -12,9 +12,9 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.28";
+our $VERSION = "0.29";
-use Devel::Cover::DB 0.28;
+use Devel::Cover::DB 0.29;
use Cwd ();
use File::Find ();
@@ -314,7 +314,7 @@ package Devel::Cover::Cpancover::Template::Provider;
use strict;
use warnings;
-our $VERSION = "0.28";
+our $VERSION = "0.29";
use base "Template::Provider";
@@ -350,7 +350,7 @@ $Templates{html} = <<'EOT';
<!--
-This file was generated by Devel::Cover Version 0.28
+This file was generated by Devel::Cover Version 0.29
Devel::Cover is copyright 2001-2003, Paul Johnson (pjcj@cpan.org)
@@ -459,7 +459,7 @@ The following exit values are returned:
=head1 VERSION
-Version 0.28 - 1st December 2003
+Version 0.29 - 19th December 2003
=head1 LICENCE
View
@@ -12,11 +12,11 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.28";
+our $VERSION = "0.29";
use blib;
-use Devel::Cover::Test 0.28;
+use Devel::Cover::Test 0.29;
my @tests = @ARGV;
View
@@ -12,9 +12,9 @@ require 5.6.1;
use strict;
use warnings;
-our $VERSION = "0.28";
+our $VERSION = "0.29";
-use Devel::Cover::DB 0.28;
+use Devel::Cover::DB 0.29;
use Getopt::Long;
use Pod::Usage;
@@ -128,7 +128,7 @@ Huh?
=head1 VERSION
-Version 0.28 - 1st December 2003
+Version 0.29 - 19th December 2003
=head1 LICENCE
Oops, something went wrong.

0 comments on commit ccdbd36

Please sign in to comment.