Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Devel-Cover CPAN distribution.

Report information
The Basics
Id: 34262
Status: resolved
Priority: 0/
Queue: Devel-Cover

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Allow -gcov to see coverage for .c and .h files.
I noticed that cover -test -gcov only picked up the coverage for XS files and not the underlying C or header files. Simply changing return unless /\.xs$/; to return unless /\.(xs|c|h)$/; in the $gc sub fixed that.
And here's the patch.
---------------------------------------------------------------------- r56018: schwern | 2008-03-22 19:53:43 -0700 Pick up gcov information for C and header files. Touch C and header files so they get rebuilt with gcov flags. ---------------------------------------------------------------------- --- local/Devel-Cover/cover (revision 56017) +++ local/Devel-Cover/cover (revision 56018) @@ -209,11 +209,11 @@ my $test = test_command(); - # touch the XS files so they rebuild + # touch the XS, C and H files so they rebuild if ($Options->{gcov}) { my $t = $] > 5.7 ? undef : time; - my $xs = sub { utime $t, $t, $_ if /\.xs$/ }; + my $xs = sub { utime $t, $t, $_ if /\.(xs|c|h)$/ }; File::Find::find({ wanted => $xs, no_chdir => 0 }, "."); } print STDERR "cover: running $test\n"; @@ -222,7 +222,14 @@ { my $gc = sub { - return unless /\.xs$/; + return unless /\.(xs|c|h)$/; + + # Don't bother running gcov if there's no index files. + # Otherwise it's noisy. + my $graph_file = $_; + $graph_file =~ s{\.\w+$}{.gcno}; + return unless -e $graph_file; + my $c = "gcov $_"; print STDERR "cover: running $c\n"; system $c; @@ -233,7 +240,7 @@ { return unless /\.gcov$/; my $xs = $_; - return if $xs =~ s/\.c\.gcov$/.xs.gcov/ && -e $xs; + return if $xs =~ s/\.(c|h)\.gcov$/.xs.gcov/ && -e $xs; s/^\.\///; push @gc, $_; };
I applied this a long time ago but forgot the say anything or to close the ticket, so please accept a belated: Applied, thanks.