[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Perl code coverage
From: |
Ralf Wildenhues |
Subject: |
Perl code coverage |
Date: |
Sun, 18 Oct 2009 11:22:31 +0200 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
I recently discovered Devel::Cover (Debian package libdevel-cover-perl).
This rocks. Kudos to Paul Johnson for writing this module.
To use Devel::Cover, I have started a branch perl-coverage (off of
maint) which introduces a few helper targets, e.g.,
make check-coverage
which is veeery slow, but also quite interesting.
I will follow up on automake-patches with the patches in the branch, as
far as I've merged it into master. (Please speak up if you'd like me to
push the branch to savannah as well; otherwise, you can easily get at it
with something like merge-point^2.)
Up to now, I've tackled the trivial pod coverage, some Perl module
coverage, and started on 'automake' script coverage, beginning at the
end of the script. A big part of it is fairly trivial, but IMHO still
worthwhile to add since it allows us to be more confident about
correctness when changing the code later. I've found a few likely bugs
with this already, too, and the peaks in the 'time' column below whisper
'missed-optimization'.
Use of Devel::Cover causes a few test failures; notably, it doesn't work
with ithreads, and it causes some output even with -silent. It might be
necessary to not close STDOUT in General::END, not sure yet about that.
In summary, running the Automake testsuite on a GNU/Linux x86 system
shows roughly the following coverage (I've had a couple of minor,
unfinished patches in the tree). For a description of the data, see:
<http://search.cpan.org/dist/Devel-Cover/lib/Devel/Cover/Tutorial.pod>.
Devel::Cover also exports very nice per-file, per-statement etc. HTML
files, I'm not sure whether it is worthwhile to put them up somewhere.
----------------------------------- ------ ------ ------ ------ ------ ------
------
File stmt bran cond sub pod time
total
----------------------------------- ------ ------ ------ ------ ------ ------
------
...make/lib/Automake/ChannelDefs.pm 93.0 92.9 n/a 88.2 88.9 0.2
92.2
...utomake/lib/Automake/Channels.pm 83.4 66.1 71.4 86.8 100.0 1.0
79.5
...tomake/lib/Automake/Condition.pm 97.8 94.8 100.0 96.2 94.7 2.2
97.1
...ake/lib/Automake/Configure_ac.pm 96.4 87.5 50.0 100.0 0.0 0.0
93.3
...e/lib/Automake/DisjConditions.pm 78.7 70.0 n/a 84.2 100.0 1.6
77.6
...tomake/lib/Automake/FileUtils.pm 56.9 31.2 18.2 76.0 100.0 0.2
50.0
...automake/lib/Automake/General.pm 100.0 100.0 n/a 100.0 0.0 0.2
100.0
...ke/automake/lib/Automake/Item.pm 100.0 50.0 66.7 100.0 100.0 1.7
94.1
...automake/lib/Automake/ItemDef.pm 100.0 n/a n/a 100.0 100.0 0.4
100.0
...utomake/lib/Automake/Location.pm 63.5 n/a 25.0 80.0 0.0 0.9
63.6
...automake/lib/Automake/Options.pm 94.8 92.5 92.3 96.0 100.0 0.1
93.7
...ke/automake/lib/Automake/Rule.pm 93.6 90.0 81.2 89.2 100.0 1.5
91.1
...automake/lib/Automake/RuleDef.pm 100.0 n/a n/a 100.0 33.3 0.1
100.0
.../automake/lib/Automake/Struct.pm 79.0 51.9 44.4 82.9 50.0 0.4
67.7
.../automake/lib/Automake/VarDef.pm 97.6 85.7 100.0 100.0 90.0 0.6
96.7
...utomake/lib/Automake/Variable.pm 95.7 86.8 83.8 96.4 100.0 3.0
92.3
...automake/lib/Automake/Version.pm 96.6 75.0 83.3 100.0 100.0 0.0
87.9
...ke/automake/lib/Automake/Wrap.pm 100.0 100.0 100.0 100.0 66.7 0.4
100.0
...e/automake/lib/Automake/XFile.pm 71.0 37.5 14.3 77.8 55.6 61.2
59.2
.../lib/Automake/tests/Condition.pl 87.9 50.0 33.3 100.0 n/a 0.0
75.5
...Automake/tests/DisjConditions.pl 82.3 50.0 44.4 100.0 n/a 0.0
72.1
...ke/lib/Automake/tests/Version.pl 66.7 50.0 n/a 100.0 n/a 0.0
65.6
...omake/lib/Automake/tests/Wrap.pl 85.7 50.0 n/a 100.0 n/a 0.0
83.3
...nload/cvs/automake/build/aclocal 97.9 93.7 72.3 97.5 n/a 17.9
94.4
...load/cvs/automake/build/automake 96.1 89.2 87.3 96.7 n/a 6.3
93.2
...ake/build/lib/Automake/Config.pm 100.0 n/a n/a 100.0 n/a 0.0
100.0
Total 92.8 83.0 81.6 93.3 86.6 100.0
89.2
----------------------------------- ------ ------ ------ ------ ------ ------
------
- Perl code coverage,
Ralf Wildenhues <=