Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

How to run Devel::Cover if we don't have a makefile?

by szabgab (Priest)
on Apr 26, 2021 at 19:22 UTC ( #11131740=perlquestion: print w/replies, xml ) Need Help??

szabgab has asked for the wisdom of the Perl Monks concerning the following question:

In this application I was trying to get a test coverage report. Using perl 5.30.3 on Ubuntu. (the system perl) and Devel::Cover 1.36 Regular prove works:
prove -l t/basic.t .. ok All tests successful. Files=1, Tests=6, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.36 cusr + 0.03 csys = 0.41 CPU) Result: PASS

HARNESS_PERL_SWITCHES=-MDevel::Cover prove -l t/basic.t t/basic.t .. All 1 subtests passed Test Summary Report ------------------- t/basic.t (Wstat: 139 Tests: 1 Failed: 0) Non-zero wait status: 139 Parse errors: No plan found in TAP output Files=1, Tests=1, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.46 cusr + 0.04 csys = 0.52 CPU) Result: FAIL
The test seem to exit after the first subtest ends.
HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lv t/basic.t t/basic.t .. # Subtest: main [2021-04-26 22:19:32.06938] [44235] [debug] [c4XVQ-tuwn5L] GET "/" [2021-04-26 22:19:32.07000] [44235] [debug] [c4XVQ-tuwn5L] Routing to +controller "Course::Management::Controller::Main" and action "welcome +" [2021-04-26 22:19:32.07163] [44235] [debug] [c4XVQ-tuwn5L] Rendering t +emplate "main/welcome.html.ep" [2021-04-26 22:19:32.07310] [44235] [debug] [c4XVQ-tuwn5L] Rendering t +emplate "layouts/default.html.ep" [2021-04-26 22:19:32.07434] [44235] [debug] [c4XVQ-tuwn5L] 200 OK (0.0 +04922s, 203.169/s) ok 1 - GET / ok 2 - 200 OK ok 3 - content is similar 1..3 ok 1 - main # Subtest: course All 1 subtests passed Test Summary Report ------------------- t/basic.t (Wstat: 139 Tests: 1 Failed: 0) Non-zero wait status: 139 Parse errors: No plan found in TAP output Files=1, Tests=1, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.46 cusr + 0.05 csys = 0.53 CPU) Result: FAIL

Here I even get a segmentation fault:
$ PERL5OPT=-MDevel::Cover perl -Ilib t/basic.t # Subtest: main ok 1 - GET / ok 2 - 200 OK ok 3 - content is similar 1..3 ok 1 - main # Subtest: course Segmentation fault (core dumped)

Another segmentation fault:
$ perl -MDevel::Cover -Ilib t/basic.t Devel::Cover: Warning: can't open blib/lib/Net/SSLeay.pm for MD5 diges +t: No such file or directory Devel::Cover: Can't find file "blib/lib/Net/SSLeay.pm" (blib/lib/Net/S +SLeay.pm (autosplit into blib/lib/auto/Net/SSLeay/randomize.al)): ign +ored. Devel::Cover 1.36: Collecting coverage data for branch, condition, pod +, statement, subroutine and time. Selecting packages matching: Ignoring packages matching: /Devel/Cover[./] Ignoring packages in: /home/gabor/perl5/lib/perl5/5.30.3/x86_64-linux-gnu-thread-multi /home/gabor/perl5/lib/perl5/5.30.3 /home/gabor/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/gabor/perl5/lib/perl5 /etc/perl /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.30.3 /usr/share/perl/5.30.3 /home/gabor/perl5/lib/perl5/5.30.2 /home/gabor/perl5/lib/perl5/5.30.2/x86_64-linux-gnu-thread-multi /home/gabor/perl5/lib/perl5/5.30.0 /home/gabor/perl5/lib/perl5/5.30.0/x86_64-linux-gnu-thread-multi # Subtest: main Devel::Cover: Warning: can't open template main/welcome.html.ep for MD +5 digest: No such file or directory Devel::Cover: Can't find file "template main/welcome.html.ep" (templat +e main/welcome.html.ep): ignored. Devel::Cover: Warning: can't open template layouts/default.html.ep for + MD5 digest: No such file or directory Devel::Cover: Can't find file "template layouts/default.html.ep" (temp +late layouts/default.html.ep): ignored. ok 1 - GET / ok 2 - 200 OK ok 3 - content is similar 1..3 ok 1 - main # Subtest: course Segmentation fault (core dumped)

Replies are listed 'Best First'.
Re: How to run Devel::Cover if we don't have a makefile?
by tobyink (Canon) on Apr 27, 2021 at 13:14 UTC

    I tend to use what you've already tried:

    HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lv t/basic.t

    Devel::Cover can cause otherwise well-behaved code to segfault occasionally. There's at least two issues in its issue tracker related to segfaults. Having skimmed your code, I don't think you're triggering either of those two, but I am pretty sure there are other unreported potential segfaults lurking in Devel::Cover.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11131740]
Approved by davies
Front-paged by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2022-08-08 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?