pjcj / Devel--Cover

Code coverage metrics for Perl
http://www.pjcj.net/perl.html
93 stars 89 forks source link

Questionable decision to include perl CORE headers in coverage report #344

Open rwfranks opened 4 months ago

rwfranks commented 4 months ago

The time has surely come to reconsider the decision to include perl included header files in the coverage report. The more ingenious the compiler engineers become in their quest for efficiency, the more uncoverable branches and statements appear in the coverage reports. None of this extraneous information is of any value to the end user.

The following report shows how bad this situation has become for this uncomplicated perl XS example.

cover: running /usr/bin/perl /home/rwf/perl5/bin/gcov2perl -db /home/rwf/devel/Net-DNS-Resolver-Unbound/cover_db sv_inline.h.gcov Unbound.xs.gcov perlstatic.h.gcov inline.h.gcov
gcov2perl: Warning: ignoring branch with 7 targets at /usr/lib64/perl5/CORE/sv_inline.h:383     switch (type) {
gcov2perl: Warning: ignoring branch with 4 targets at /usr/lib64/perl5/CORE/sv_inline.h:420         switch(type) {
gcov2perl: Writing coverage database to /home/rwf/devel/Net-DNS-Resolver-Unbound/cover_db/runs/1721594850.17753.20173
gcov2perl: Writing coverage database to /home/rwf/devel/Net-DNS-Resolver-Unbound/cover_db/runs/1721594850.17753.65286
gcov2perl: Writing coverage database to /home/rwf/devel/Net-DNS-Resolver-Unbound/cover_db/runs/1721594850.17753.62899
gcov2perl: Writing coverage database to /home/rwf/devel/Net-DNS-Resolver-Unbound/cover_db/runs/1721594850.17753.05179
Reading database from /home/rwf/devel/Net-DNS-Resolver-Unbound/cover_db

---------------------------- ------ ------ ------ ------ ------ ------ ------
File                           stmt   bran   cond    sub    pod   time  total
---------------------------- ------ ------ ------ ------ ------ ------ ------
...lib64/perl5/CORE/inline.h  100.0    n/a    n/a    n/a    n/a    n/a  100.0
...4/perl5/CORE/perlstatic.h  100.0    n/a    n/a    n/a    n/a    n/a  100.0
...64/perl5/CORE/sv_inline.h   32.6   19.6    n/a    n/a    n/a    n/a   27.8
Unbound.xs                    100.0  100.0    n/a    n/a    n/a    n/a  100.0
...t/DNS/Resolver/Unbound.pm  100.0  100.0  100.0  100.0  100.0  100.0  100.0
Total                          83.8   68.7  100.0  100.0  100.0  100.0   82.1
---------------------------- ------ ------ ------ ------ ------ ------ ------
mohawk2 commented 3 weeks ago

If you use the -relative_only flag (and for more complex distros, also -gcov_chdir) in https://metacpan.org/dist/Devel-Cover/view/bin/cover, you shouldn't see this, since that's why I added them. @kiwiroy perhaps of interest to you too