Friends,
As an extension of my work on
https://rt.perl.org/rt3/Ticket/Display.html?id=112126, I am trying to
measure the test coverage for Perl 5 core distribution Hash-Util
provided by the Perl 5 test suite. For ease of development, I have
copied ext/Hash-Util/lib/Hash/Util.pm and ext/Hash-Util/t/Util.t into a
typical CPAN distribution setup. I have applied the patches submitted
in RT #112126 and modified t/Util.t to remove all the setup needed to
run it as part of the Perl 5 test suite and instead run it as if it were
a part of a regular CPAN distribution.
So I'm now at a point where I want to perform coverage analysis.
However, try as I might, I cannot get a report of the test coverage of
lib/Hash/Util.pm I want -- and this having used Devel::Cover for nine years!
Please see the attachment in which I show the output of:
perl Makefile.PL && make && cover -test
Note that I *am* getting coverage output for Util.xs, but I'm *not*
getting coverage for lib/Hash/Util.pm. This is most puzzling.
I have Devel::Cover version 0.80 installed and am running this with Perl
5.14.2.
To facilitate getting assistance with this, I have push my
quasi-distribution to Github:
https://github.com/jkeenan/Hash-Util
Can anyone advise as to why I am getting coverage analysis of Util.xs
but not of lib/Hash/Util.pm?
Thank you very much.
Jim Keenan
[hashutil] 770 $ perl Makefile.PL && make
Checking if your kit is complete...
Looks good
Writing Makefile for Hash::Util
Writing MYMETA.yml and MYMETA.json
cp lib/Hash/Util.pm blib/lib/Hash/Util.pm
/usr/local/bin/perl /usr/local/lib/perl5/5.14.2/ExtUtils/xsubpp -typemap
/usr/local/lib/perl5/5.14.2/ExtUtils/typemap Util.xs > Util.xsc && mv Util.xsc
Util.c
cc -c -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe
-I/usr/local/include -I/opt/local/include -O3 -DVERSION=\"0.11\"
-DXS_VERSION=\"0.11\" "-I/usr/local/lib/perl5/5.14.2/darwin-2level/CORE"
-DPERL_EXT Util.c
Running Mkbootstrap for Hash::Util ()
chmod 644 Util.bs
rm -f blib/arch/auto/Hash/Util/Util.bundle
env MACOSX_DEPLOYMENT_TARGET=10.3 cc -bundle -undefined dynamic_lookup
-L/usr/local/lib -L/opt/local/lib Util.o -o
blib/arch/auto/Hash/Util/Util.bundle \
\
chmod 755 blib/arch/auto/Hash/Util/Util.bundle
cp Util.bs blib/arch/auto/Hash/Util/Util.bs
chmod 644 blib/arch/auto/Hash/Util/Util.bs
Manifying blib/man3/Hash::Util.3
[hashutil] 771 $ cover -delete
Deleting database /Users/jimk/gitwork/hashutil/cover_db
[hashutil] 772 $ cover -test
Deleting database /Users/jimk/gitwork/hashutil/cover_db
cover: running make test "OPTIMIZE=-O0 -fprofile-arcs -ftest-coverage"
"OTHERLDFLAGS=-fprofile-arcs -ftest-coverage"
cc -c -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe
-I/usr/local/include -I/opt/local/include -O0 -fprofile-arcs -ftest-coverage
-DVERSION=\"0.11\" -DXS_VERSION=\"0.11\"
"-I/usr/local/lib/perl5/5.14.2/darwin-2level/CORE" -DPERL_EXT Util.c
rm -f blib/arch/auto/Hash/Util/Util.bundle
env MACOSX_DEPLOYMENT_TARGET=10.3 cc -bundle -undefined dynamic_lookup
-L/usr/local/lib -L/opt/local/lib Util.o -fprofile-arcs -ftest-coverage -o
blib/arch/auto/Hash/Util/Util.bundle \
\
chmod 755 blib/arch/auto/Hash/Util/Util.bundle
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Util.t .. ok
All tests successful.
Files=1, Tests=235, 4 wallclock secs ( 0.25 usr 0.06 sys + 2.45 cusr 0.24
csys = 3.00 CPU)
Result: PASS
cover: running gcov -abc -o . Util.c
File 'Util.c'
Lines executed:84.48% of 58
Branches executed:100.00% of 36
Taken at least once:47.22% of 36
No calls
Util.c:creating 'Util.c.gcov'
File 'Util.xs'
Lines executed:88.24% of 17
Branches executed:76.92% of 26
Taken at least once:61.54% of 26
No calls
Util.xs:creating 'Util.xs.gcov'
cover: running gcov -abc -o . Util.xs
File 'Util.c'
Lines executed:84.48% of 58
Branches executed:100.00% of 36
Taken at least once:47.22% of 36
No calls
Util.c:creating 'Util.c.gcov'
File 'Util.xs'
Lines executed:88.24% of 17
Branches executed:76.92% of 26
Taken at least once:61.54% of 26
No calls
Util.xs:creating 'Util.xs.gcov'
cover: running /usr/local/bin/gcov2perl -db
/Users/jimk/gitwork/hashutil/cover_db Util.xs.gcov
gcov2perl: Writing coverage database to
/Users/jimk/gitwork/hashutil/cover_db/runs/1335401664.24942.61966
Reading database from /Users/jimk/gitwork/hashutil/cover_db
--------------------------------------------------------------- ------ ------
File stmt total
--------------------------------------------------------------- ------ ------
Util.xs 88.2 88.2
Total 88.2 88.2
--------------------------------------------------------------- ------ ------
Writing HTML output to /Users/jimk/gitwork/hashutil/cover_db/coverage.html ...
done.