Discussion:
TPF Devel::Cover grant report May 2012
Paul Johnson
2012-06-15 10:07:44 UTC
Permalink
In accordance with the terms of my grant from TPF this is the monthly
report for my work on improving Devel::Cover covering May 2012.

This report is essentially the same as my report for the first week, but
that will not be the usual case. If you read that report you can safely
skip this one.

You may recall that recently I submitted a grant proposal to The Perl
Foundation to work on Devel::Cover. I'd like to thank everyone who
thought that this might be a good idea, and I'm pleased to say that the
proposal was accepted and I have started work. Modelled on the
successful grants of Dave and Nick, one of the conditions of the grant
is that I should produce weekly and monthly reports of my progress, and
these reports will be sent to perl-***@perl.org. If you are not
interested in these reports, please set up a filter, or just ignore
them.

I suppose there are two deliverables this month - Devel::Cover 0.87 and
http://cpancover.com

My plan is to work primarily on existing, relatively simple bugs and
problems before getting down to the complicated bugs and the more
interesting work of adding functionality, and most of my work so far has
indeed fallen into that category. There have been a couple of
deviations from that - one planned and one not. Much of the rest of my
work was related to Moose and Mouse. I've had a report about Moo which
I need to look at, but I've heard nothing about Mo so I'm not sure if
there are any problems there.

Very shortly after I started work perl-5.16.0 was released. So the second bug
that I looked at was RT 75314 which concerned a regression on condition cover
in 5.16. Unfortunately this problem went to the core of one of the most
tricky parts of Devel::Cover and it took me quite some time to get to the
bottom of it. The good news though, is that without this grant I would never
have been able to solve this problem and so condition and branch coverage in
5.16 would have been broken.

The bulk of the fix is found in f26ba32 and it relates to an
optimisation from David Mitchell:
http://perl5.git.perl.org/perl.git/blobdiff/0e1b3a4b35c4f6798b244c5b82edcf759e9e6806..db4d68cf2dda3f17:/op.c

Nick's bisecting code in the perl core was very helpful in fingering
this commit but, really, I should have remembered it. When Dave
announced this optimisation, I suspected that it would affect
Devel::Cover, but I had not fully followed up on that. The problem for
Devel::Cover is that I was depending on that op ordering to properly
calculate condition coverage.

Devel::Cover has two ways of collecting condition coverage, depending on
whether or not the condition is short circuited. If it is short
circuited, then when we get to the condition all we have to do is look
at the top of the stack to see whether the LHS is true or false. If
not, we have to remember that we are interested in the value of the RHS
when it has been evaluated.

Devel::Cover does this by hijacking the op_next pointer to look at the
value of the RHS and collect its coverage before moving on to the
expected op. The optimisation meant that we never evaluated the RHS and
so Devel::Cover didn't know its value. So Devel::Cover fell back to its
default behaviour in such cases which is to assume that the RHS is
false, as it is in cases when we never return a value from the RHS.
This is somewhat simplified, but gives you the idea of what is going on.
(Incidently, this is also the primary reason that Devel::Cover doesn't
run under threads.)

The solution to this involves grovelling around the optree a little more
to find the conditional ops and, whilst it solves most of the problems,
there is still a little work to be done in this area. (Where "a little"
means that the problem is simple, but the solution may not be.)

There's also a question here of whether Devel::Cover should be doing
this sort of thing, or whether I should be adding some hooks into the
core, for example. Hopefully, I will be able to look into such matters
later.

The other main area I looked at was getting cpancover up and running
again. This is not completely altruistic, since I tend to think of CPAN
as my extended test suite. I think cpancover could be quite useful, and
the current version gets many hits.

To this end, I was able to procure a machine from the nice folk at
bigv.io and I bought the domain name cpancover.com, with the result that
http://cpancover.com now points to an updated list of coverage for some
CPAN modules, run against perl 5.16.0. If there are any modules you
would like to see added here, please let me know, or just make your
changes to utils/install_modules in https://github.com/pjcj/Devel--Cover
and send me a pull request.

So, the work I have completed in the time covered by this report is:

Closed RT tickets:
75944 Warning about Moose clearers when processing Test::TempDir
75314 conditional testing broken in blead?
73452 Bleadperl v5.15.5-331-g4d8ac5c breaks PJCJ/Devel-Cover-0.79.tar.gz
69892 Tests busted on perl 5.15
57174 Devel::Cover 0.66 does not work with Moose+type constraints
68389 Moose's make_immutable call causes Devel::Cover to emit many warnings
77163 t/e2e/amoose_basic.t fails while installing Devel::Cover 0.86
37350 Missing whatis entry of Devel::Cover::Tutorial manual
71680 Devel::Cover spews error-messages when Moose is used
72819 0% branch coverage for methods defined in non-reported files
68353 perl 5.14.0 breaks D:C in t/e2e/ainc_sub.t
63090 conditionals where one element is data from a Moose attrib are not evaluated
63568 Devel::Cover can't handle Test::More's is()

Closed Github tickets:

12 Devel::Cover 0.80 and up fails t/e2e/amoose_basic.t
9 Remove use Data::Dumper from Devel::Cover

Merged pull requests:

14 -launch option opens report in appropriate viewer

Fixed cpantesters reports:

http://www.cpantesters.org/cpan/report/370c28c8-a3ef-11e1-b57c-2d415ba78cfe
http://www.cpantesters.org/cpan/report/363db460-91a3-11e1-a1fe-d0960df65b4f
http://www.cpantesters.org/cpan/report/e042a488-9109-11e1-bd3e-c0e207492f11
And many more covering the same problems in various guises.

You can see the commits at https://github.com/pjcj/Devel--Cover/commits/master

Hours worked: 44:10
--
Paul Johnson - ***@pjcj.net
http://www.pjcj.net
Ricardo Signes
2012-06-18 14:43:52 UTC
Permalink
Post by Paul Johnson
In accordance with the terms of my grant from TPF this is the monthly
report for my work on improving Devel::Cover covering May 2012.
Thanks, Paul! Looks good to me.
--
rjbs
Florian Ragwitz
2012-06-20 18:38:11 UTC
Permalink
Post by Paul Johnson
In accordance with the terms of my grant from TPF this is the monthly
report for my work on improving Devel::Cover covering May 2012.
Looks good to me. Thanks, Paul!

Loading...