develooper Front page | perl.qa | Postings from February 2010

Devel::Cover not merging results from script runs?

From:
Roland Roberts
Date:
February 20, 2010 10:52
Subject:
Devel::Cover not merging results from script runs?
Message ID:
4B7EE2CA.3010208@astrofoto.org
I've written a module for internal use at work and am trying to add a 
test suite for the primary script which uses the module.  I have good 
coverage analysis test results for the module itself.

To do this, I added a few tests in the t/ subdir that run the script via 
system() and capture the output.  These mostly test for expected exit 
status and output based on various options and input files.  These get 
run several times with the system call looking something like this:

if (exists($INC{'Devel/Cover.pm'})) {
     $rc = system("perl", "-MDevel::Cover", "blib/script/fvdcs-sweep.pl 
bogus.file");
} else {
     $rc = system("perl", "-MDevel::Cover", "blib/script/fvdcs-sweep.pl 
bogus.file");
}
isnt($rc, 0, "Missing/non-existent file exits with error");

After adding more tests, I noticed that the coverage analysis wasn't 
really making sense; tests which I *knew* were tripping certain lines of 
code still had those lines of code marked as uncovered.

Finally, I resorted to running a couple by hand from the command 
prompt.  If I run a test which has high coverage followed by one which 
has lower (but different) coverage, I end up with a final report that 
shows only the lower coverage.  After reading the man page, I changed 
"-MDevel::Cover" to "-MDevel::Cover=-merge" but that has no effect.

Version info:
736 roland> rpm -q perl-Devel-Cover
perl-Devel-Cover-0.64-2.fc11.i586
737 roland> rpm -q perl
perl-5.10.0-82.fc11.i586

Is this supposed to work, or am I misreading the documentation?

roland

-- 
		       PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                             RL Enterprises
roland@rlenter.com                            6818 Madeline Court
roland@astrofoto.org                           Brooklyn, NY 11220




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