Devel--Cover icon indicating copy to clipboard operation
Devel--Cover copied to clipboard

html_basic report broken (missing sub headers and package statements)

Open perlpunk opened this issue 2 years ago • 2 comments

I was trying out the html_basic report and noticed that all subroutine headers and package statements are missing from the report. They are not even counted, so that the line numbers are also off.

Unfortunately I cannot reproduce it on my machine, only in a docker container. registry.opensuse.org/devel/openqa/containers15.3/os-autoinst_dev It's openSUSE Leap 15.3 with perl 5.26.1

I put together a simple reproducer:

$ cat t/foo.t
use strict;
use warnings;
use Test::More tests => 1;
use Foo;
my $x = Foo::foo(21);
is $x, 42, "x=42";
$ cat lib/Foo.pm
package Foo;
use strict;
use warnings;

sub foo {
    my ($arg) = @_;
    return $arg * 2;
}

1;
$ PERL5OPT=-MDevel::Cover prove -l t/foo.t
...
$ cover -report html_basic cover_db
Reading database from /tmp/autoinst/cover_db


-------------- ------ ------ ------ ------ ------ ------ ------
File             stmt   bran   cond    sub    pod   time  total
-------------- ------ ------ ------ ------ ------ ------ ------
/usr/bin/prove  100.0   50.0    n/a  100.0    n/a   15.7   87.5
lib/Foo.pm      100.0    n/a    n/a  100.0    0.0    0.0   91.6
t/foo.t         100.0    n/a    n/a  100.0    n/a   84.2  100.0
Total           100.0   50.0    n/a  100.0    0.0  100.0   93.1
-------------- ------ ------ ------ ------ ------ ------ ------


HTML output written to /tmp/autoinst/cover_db/coverage.html

Here's a screenshot of the report: devel-cover-html-basic-report

Installed is Devel::Cover 1.36, but there is no difference when I install 1.38.

When I use this example on my laptop, then I actually get the same bug as reported in #270 , but so far I wasn't able to find out which different module versions are responsible for that. devel-cover-html-basic-report-one-line

Let me know if you need more information. But if you pull the mentioned docker image, you should be able to reproduce it.

perlpunk avatar Jun 16 '22 10:06 perlpunk

I have just installed version 1.38 and can confirm this happens natively too (ie. outside a container).

openstrike avatar Aug 03 '22 14:08 openstrike

Adding a switch noppihtml like "cover -report html_basic -noppihtml cover_db" works for me.

WenjingLi2036 avatar Aug 10 '22 09:08 WenjingLi2036