develooper Front page | perl.perl5.porters | Postings from July 2001

Testsuite Coverage analysis

Thread Next
From:
Tels
Date:
July 29, 2001 05:31
Subject:
Testsuite Coverage analysis
Message ID:
perl.perl5.porters-40993@nntp.perl.org
-----BEGIN PGP SIGNED MESSAGE-----

Moin,

after reading brian d foy's DDJ article I found what I always longed
for: A tool to measure the "quality" of my tests: Devel::Coverage.

It is a bit limited, though, so I hacked together Devel::Coverage::Stats.
With this you are finally able to see how much of your code is really
covered by your test suite, and what it misses.

Description, a pre-release (v1.04) and a coverage report over Perl 5.6.1
are at http://bloodgate.com/perl/cover.html

I had problems running the Perl testsuite trough this, and for Perl v5.7.2
or later it failed in many interesting ways (You can't run Perl 5.7.2
testsuite with Perl 5.6.0, but if you run it with ./perl, you do not have
Devel::Coverage, and even if you cheat and have it, it complains about
missing DB stuff. And even if you all have this (by running the 5.6.1
testsuite trough 5.6.1 with some tricks, the test files will gladly
overwrite @INC, shift dirs etc, thus a lot of them fail. I wonder how
Harness manages this all ;o)

If anybody has any comments, insights, or bug reports, please email me. It
would be cool to see a full report over bleadperl.

Best regards,

Tels

Sample report over Math::BigInt v1.39:


CoverStats  v1.04 (c) Copyright by Tels 2001.  Have fun!
include -Iblib/lib/

Sun Jul 29 14:24:08 2001 Gathering files, please wait ...

Covering the following files:
 blib/lib/Math/BigFloat.pm
 blib/lib/Math/BigInt.pm
 blib/lib/Math/BigInt/Calc.pm
 blib/lib/Math/BigInt/Scalar.pm

by executing the following:
 t/bigfltpm.t
 t/bigintc.t
 t/bigintpm.t
 t/bigints.t
 t/mbimbf.t

Sun Jul 29 14:24:08 2001 Starting analysis, please wait ...

Exorcising 't/bigfltpm.t':
 Executing 'perl -d:Coverage -Iblib/lib/ t/bigfltpm.t' ... done.
 Reading data ... done.

Exorcising 't/bigintc.t':
 Executing 'perl -d:Coverage -Iblib/lib/ t/bigintc.t' ... done.
 Reading data ... done.

Exorcising 't/bigintpm.t':
 Executing 'perl -d:Coverage -Iblib/lib/ t/bigintpm.t' ... done.
 Reading data ... done.

Exorcising 't/bigints.t':
 Executing 'perl -d:Coverage -Iblib/lib/ t/bigints.t' ... done.
 Reading data ... done.

Exorcising 't/mbimbf.t':
 Executing 'perl -d:Coverage -Iblib/lib/ t/mbimbf.t' ... done.
 Reading data ... done.


Files covered: 4/4 (100.00%)

Coverage statistics for file blib/lib/Math/BigFloat.pm:
  Sub routines  : 46
  Covered       : 35    (76.09%)
  Covered fully : 25    (54.35%)
  Covered partly: 10    (21.74%)
  Not covered   : 11    (23.91%)
    __ANON__[blib/lib//Math/BigFloat.pm:1028]                        1 line 
    __ANON__[blib/lib//Math/BigFloat.pm:40]                          1 line 
    bacmp                                                            5 lines
    bfloat                                                           1 line 
    bgcd                                                             4 lines
    bint                                                             1 line 
    blcm                                                             4 lines
    exponent                                                         4 lines
    length                                                           8 lines
    mantissa                                                         6 lines
    parts                                                            6 lines
  2 uncovered lines in sub 'AUTOLOAD':
    960 - 961
  2 uncovered lines in sub 'bcmp':
    327 - 328
  6 uncovered lines in sub 'bdiv':
    647 - 649, 652 - 653, 655
  1 uncovered line in sub 'bfround':
    859
  1 uncovered line in sub 'binf':
    171
  1 uncovered line in sub 'bmod':
    669
  1 uncovered line in sub 'bnan':
    154
  1 uncovered line in sub 'bone':
    188
  1 uncovered line in sub 'bzero':
    203
  2 uncovered lines in sub 'import':
    1024, 1029
  Lines covered: 374/433 (86.37%)

Coverage statistics for file blib/lib/Math/BigInt.pm:
  Sub routines  : 100
  Covered       : 98    (98%)
  Covered fully : 83    (83%)
  Covered partly: 15    (15%)
  Not covered   : 2     (2%)
    __ANON__[blib/lib//Math/BigInt.pm:80]                            1 line 
    bint                                                             1 line 
  1 uncovered line in sub '__from_bin':
    1687
  1 uncovered line in sub '__from_hex':
    1647
  3 uncovered lines in sub '_trailing_zeros':
    1212, 1214 - 1215
  2 uncovered lines in sub 'band':
    1086 - 1087
  2 uncovered lines in sub 'bcmp':
    590 - 591
  6 uncovered lines in sub 'bgcd':
    745, 750, 752 - 755
  1 uncovered line in sub 'binf':
    376
  2 uncovered lines in sub 'bior':
    1121 - 1122
  1 uncovered line in sub 'blcm':
    726
  2 uncovered lines in sub 'bpow':
    995 - 996
  2 uncovered lines in sub 'bxor':
    1158 - 1159
  1 uncovered line in sub 'cmp':
    1808
  4 uncovered lines in sub 'copy':
    230, 234, 239, 241
  1 uncovered line in sub 'import':
    1628
  1 uncovered line in sub 'objectify':
    1548
  Lines covered: 652/684 (95.32%)

Coverage statistics for file blib/lib/Math/BigInt/Calc.pm:
  Sub routines  : 24
  Covered       : 24    (100.00%)
  Covered fully : 22    (91.67%)
  Covered partly: 2     (8.33%)
  3 uncovered lines in sub '_base_len':
    68 - 70
  2 uncovered lines in sub '_div':
    292, 340
  Lines covered: 231/236 (97.88%)

Coverage statistics for file blib/lib/Math/BigInt/Scalar.pm:
  Sub routines  : 23
  Covered       : 18    (78.26%)
  Covered fully : 18    (78.26%)
  Covered partly: 0     (0%)
  Not covered   : 5     (21.74%)
    _and                                                             3 lines
    _len                                                             1 line 
    _or                                                              3 lines
    _pow                                                             3 lines
    _xor                                                             3 lines
  Lines covered: 48/61 (78.69%)

Summary over all files:
  Sub routines  : 193
  Covered       : 175   (90.67%)
  Covered fully : 148   (76.68%)
  Covered partly: 27    (13.99%)
  Lines total   : 1414
  Lines covered : 1305  (92.29%)

  Files executed: 5/5   (100.00%)


Sun Jul 29 14:24:40 2001 Done





- -- 
perl -MMath::String -e 'print \
Math::String->from_number("215960156869840440586892398248"),"\n"'

 http://bloodgate.com/thief/     Thief - The Dark Project
 http://bloodgate.com/perl       My current Perl projects
 http://freedomforlinks.de       Fight for your right to link. 
 PGP key available on http://bloodgate.com/tels.asc or via email.


-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: latin1

iQEVAwUBO2QBJHcLPEOTuEwVAQEdNgf5AYiMhL7EO6E18cC4C+cxXOu9QD5mcjgH
SWrTZ0ndEE6Qu0xP70u7MU0hPdKHGAza2VZuhU9Cy0tlY2dwXENyCxdHzdxEm3JY
ptZGGKIPb+xVwnDk9WDxxTPajtbTHc2Wv+Ey08C+EFDIw39SYI7aWeK8HElZePXA
bpFKYlyavt80aWa5WmpTW0mM+Ky+ghTwkqa+uDRNzU6XbCG2GjgxhB5LphQUXtmu
LZEcdKY6XtMDEpXYDfOgzIlYWuuD1SbJ6drRZ7TmqQnzEmh6L6zcp6Oo8unAb7zx
xswzePp5P48TIqh0XKDysc9THyVuodPMLEMdVSpop4u4NoTA/ypZ4g==
=ZkuT
-----END PGP SIGNATURE-----

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About