Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

How To Merge Devel::Cover databases

by DrWhy (Chaplain)
on Jul 10, 2009 at 17:32 UTC ( [id://778988]=perlquestion: print w/replies, xml ) Need Help??

DrWhy has asked for the wisdom of the Perl Monks concerning the following question:

Dear brothers and sisters of the Monastery,

I need to merge a complex set of Devel::Cover databases in order to get global usage measures, and am having some difficulty. The core problem is that while results from usage of Perl module files (.pm) can be combined across multiple databases, results for multiple perl scripts (.pl) cannot. You can apparently merge databases by calling

cover database1 database2 database3 ...

In the combined results coming out of this, all the .pm files have reasonable looking coverage metrics, and one of the .pl files does as well, but all the other .pl files while they are lissted in the output table have all 'n/a' for their coverage metrics. Has anyone ever had to do this before and come up with a good solution?

Here's a little more about my situation. I have a large, highly parallel system that I'd like to compute test coverage for. This system consists of multiple perl scripts and modules. The modules are used by multiple scripts, and some scripts call other scripts as well. The scripts often run in parallel on a Condor system with several nodes (so that scripts may be running at the same time on different comptuters all sharing the same NFS filesystem). Devel::Cover seems to be the only game in town for Perl test coverage measurement tools so that's what we are using. Because different pieces of the system run in parallel and Devel::Cover is not multi-process safe -- attempting to have all processes use the same coverage database results in a corrupted database and crashing scripts -- I have to specify a separate database for every run of every script (some scripts are run multiple times during one execution of the system)

--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

Replies are listed 'Best First'.
Re: How To Merge Devel::Cover databases
by DrWhy (Chaplain) on Jul 11, 2009 at 08:09 UTC
    After staring at Devel::Cover code for most of a day I believe the crux of the problem is that the cover program merges only half of the databases. It merges that runs portion which contains basic count statistics but does not merge the structure portion which contains mappings of counts data to source code locations. The solution is pretty straigthforward, a function to copy missing structure files from the various source databases into the structures directory for the target database.

    It has nothing to do with a difference between the handling of .pm and .pl files.

    I'm at least 75% sure this is right :)

    --DrWhy

    "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

      Dear Dr. Why and other denizens and seekers of Perl wisdom,

      I have encountered a similar issue and need to merge Devel::Cover databases. Did you (or anyone else) make any progress on this issue? Thanks.

      An unworthy Physicist posing as a Perl programmer,

      gcmandrake
        In fact I did solve that problem along with a couple of other issues I ran into along the way. I've been meaning to send diffs to the module's maintainer for inclusion in a future release, but it seems my big bag of round tuits has holes in it and the tuits keep leaking out.

        Maybe this will give me the excuse I need to move this forward.

        --DrWhy

        "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

        I did hack similar problem with few steps:
        1. Check which of databases has the most files (let's say it is database3 in original example)
        2. Put that database first in the command, i.e.

        cover database3 database1 database2 ...

        it seems to work for me - maybe will help somebody as well.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://778988]
Approved by zwon
Front-paged by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-24 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found