On Sat, Aug 04, 2012 at 12:19:18PM -0400, James E Keenan wrote:
> On 8/4/12 11:34 AM, James E Keenan wrote:
> >On 8/4/12 11:16 AM, James E Keenan wrote:
> >>On 8/4/12 10:54 AM, Paul Johnson wrote:
> >>How did you generate
> >>>your coverage report?
> >>>
> >>
> >>Main part of my shell script:
> >>
> >>cd $SOURCEDIR && \
> >>cover -delete $COVERAGEDIR && \
> >>PERL5OPT=-MDevel::Cover=-db,$COVERAGEDIR/ \
> >>perl Makefile.PL && make && make test && \

I think the root of the problem lies here.  If I'm not mistaken, I think
that $PERL5OPT will only have this value for the call of "perl
Makefile.PL" and not for make and make test.

> >>cover $COVERAGEDIR \

And if PERL5OPT was set here you would get am error message that "cover"
shouldn't be run with coverage turned on.

> >>-coverage statement \
> >>-coverage branch \
> >>-coverage condition \
> >>-coverage subroutine \
> >>-ignore_re '^t\/' \
> >>-ignore_re '^\/usr\/local\/bin' \
> >>-ignore_re '^\/tmp' \
> >>chmod 0755 $COVERAGEDIR/

Might I suggest something like this?

cd $SOURCEDIR && \
cover -delete $COVERAGEDIR && \
perl Makefile.PL && \
HARNESS_PERL_SWITCHES=-MDevel::Cover=-db,$COVERAGEDIR,-coverage,statement,branch,condition,subroutine
 make test && \
cover $COVERAGEDIR

Or, perhaps better still,

cd $SOURCEDIR && \
perl Makefile.PL && \
DEVEL_COVER_OPTIONS=-db,$COVERAGEDIR,-coverage,statement,branch,condition,subroutine
 cover -test $COVERAGEDIR

> >Data point: When I call this command, the first thing I get is a couple
> >of dozen warnings like this:
> >
> >Devel::Cover: Warning: can't open ro-accessor for object_id
> >(.../test-more/blib/lib/TB2/Mouse.pm) for MD5 digest: No such file or
> >directory
> >
> >... even though blib/lib/TB2/Mouse.pm clearly exists.

Mouse.pm exists, but
"ro-accessor for object_id (.../test-more/blib/lib/TB2/Mouse.pm)" doesn't.
That's the made-up filename that that Mouse has pretended was the
location of that code.  Recent versions of Devel::Cover should suppress
that warning.

> 
> And a further data point:
> 
> When I call a command as simple as:
> 
>   cover $COVERAGEDIR -summary
> 
> ... I fail to get reporting on the three packages mentioned earlier,
> though all tests pass.  This suggests that for some reason data is
> not being recorded in the Devel::Cover DB.

Hopefully I've explained why above.  What's confusing me is why you're
getting as much coverage as you are.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

Reply via email to