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: 14709
Status: resolved
Priority: 0/
Queue: Devel-Cover

People
Owner: Nobody in particular
Requestors: chris+rt [...] chrisdolan.net
Cc:
AdminCc:

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



Subject: Auto-detect when to rebuild cover_db files when .pm files change
I use Devel::Cover via the Module::Build testcover action. However, when I change my .pm files and re-run, Devel::Cover gets very confused about line numbers, as it caches lots of information about the previous version of the .pm files. I propose that Devel::Cover keep a timestamp or checksum of each .pm that has been profiled. When that indicator changes for the live .pm file, Devel::Cover should expunge all profile information about that file from the cover_db. Perhaps the entire cover_db should be deleted, since interactions between the modules could cause old data to be invalid (e.g. if the API changes in a dependent module). As a workaround, I've submitted a bug to Module::Build to auto-delete the cover_db directory if any .pm files have changed, but it would be better if Devel::Cover tried to do this by itself. -- Chris
Date: Thu, 22 Sep 2005 22:41:21 +0200
From: Paul Johnson <paul [...] pjcj.net>
To: via RT <bug-Devel-Cover [...] rt.cpan.org>
CC: undisclosed-recipients: ;
Subject: Re: [cpan #14709] Auto-detect when to rebuild cover_db files when .pm files change
RT-Send-Cc:
On Thu, Sep 22, 2005 at 02:16:59PM -0400, via RT wrote: Show quoted text
> I use Devel::Cover via the Module::Build testcover action. However, > when I change my .pm files and re-run, Devel::Cover gets very confused > about line numbers, as it caches lots of information about the > previous version of the .pm files. > > I propose that Devel::Cover keep a timestamp or checksum of each .pm > that has been profiled. When that indicator changes for the live .pm > file, Devel::Cover should expunge all profile information about that > file from the cover_db. Perhaps the entire cover_db should be > deleted, since interactions between the modules could cause old data > to be invalid (e.g. if the API changes in a dependent module). > > As a workaround, I've submitted a bug to Module::Build to auto-delete > the cover_db directory if any .pm files have changed, but it would be > better if Devel::Cover tried to do this by itself.
This already happens. The MD5 sum of the file is used, and should it change the old data is deleted. There is even a test for this, but of course there is still the possibility of an error. Is this something specific to Module::Build in some way? I can't see how it could be, but I don't use Module::Build very often. Can you let me know how to repeat the problem? Thanks, -- Paul Johnson - paul@pjcj.net http://www.pjcj.net
From: cdolan [...] cpan.org
Paul, Thanks for the reply. I didn't know it already did checksums. I will attemp to reproduce a concrete failure for you, but here's what I saw that led me to post the bug report: * Ran tests with Module::Build's testcover action - that action simply runs Test::Harness with $HARNESS_PERL_SWITCHES = "-MDevel::Cover"; * Edited my .pm file to fix a bug * Ran tests with testcover again * Looked at coverage.html * Saw that the line numbers and profile numbers no longer corresponded to the actual lines of code. -- Chris
Paul, I created a test case that seems to reproduce the problem. Attached is Foo.tgz which is a bare-bones Module::Builod package. Note that I'm currently running Module::Build 0.2611 and Devel::Cover 0.55 under Mac OSX Perl 5.8.6. I *think* the version of Module::Build should not matter, since that's just using Devel::Cover via Test::Harness. * run "perl Build.PL" * run "Build testcover" * open cover_db/coverage.html in a browser * edit lib/Foo.pm to add the line 'print "here\n";' before the other print statement * run "Build testcover" again * reload coverage.html Actual results: The report has numbers for the first print, but not the second Expected results: The report should have coverage data for both print statements You can see my results here: http://www.chrisdolan.net/perl/Foo/cover_db/blib-lib-Foo-pm.html Please note that a workaround for this problem is being implemented for Module::Build in RT bug 14694. The workaround is to delete the cover_db dir if any .pm files are changed. -- Chris
Download Foo.tgz
application/x-tar 535b

Message body not shown because it is not plain text.

Just a note that the latest Module::Build has a workaround for this problem: it deletes the cover_db directory if it detects that any files (primarily *.pm) in blib have changed. Resolved M::B bug: http://rt.cpan.org/NoAuth/Bug.html?id=14694 -- Chris
On Thu Sep 22 16:43:46 2005, paul@pjcj.net wrote: Show quoted text
> This already happens. The MD5 sum of the file is used, and should it > change the old data is deleted. There is even a test for this, but of > course there is still the possibility of an error.
Why not just automatically delete the database every time? Is there some performance-related reason I'm not aware of? Every time I use Devel::Cover, I'm doing it as part of my testing and I'm not time-bound. If I need to, I'll go get a cup of coffee or something. Rob
Subject: Re: [rt.cpan.org #14709] Auto-detect when to rebuild cover_db files when .pm files change
Date: Mon, 16 Jan 2006 23:39:29 -0600
To: bug-Devel-Cover [...] rt.cpan.org
From: Chris Dolan <chris [...] clotho.com>
Devel::Cover is useful for collecting performance and coverage data over multiple runs of an application. That's the primary motivation for keeping stats across runs. Chris On Jan 16, 2006, at 8:26 PM, via RT wrote: Show quoted text
> On Thu Sep 22 16:43:46 2005, paul@pjcj.net wrote:
>> This already happens. The MD5 sum of the file is used, and should it >> change the old data is deleted. There is even a test for this, >> but of >> course there is still the possibility of an error.
> > Why not just automatically delete the database every time? Is there > some > performance-related reason I'm not aware of? Every time I use > Devel::Cover, I'm doing it as part of my testing and I'm not time- > bound. > If I need to, I'll go get a cup of coffee or something. > > Rob
-- Chris Dolan, Software Developer, Clotho Advanced Media Inc. 608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703 vCard: http://www.chrisdolan.net/ChrisDolan.vcf Clotho Advanced Media, Inc. - Creators of MediaLandscape Software (http://www.media-landscape.com/) and partners in the revolutionary Croquet project (http://www.opencroquet.org/)
I believe this problem should be fixed with some recent changes to the code in this area, in particular the addition of a digests file into the database. These changes will be int he next release. I'm closing the ticket for now, but feel free to reopen it if you can repeat the problem. Thanks,