note
pryrt
<blockquote><i>But generating a test coverage report depends on the codebase, not the environment, unless you're using it in some way I've not encountered.</i></blockquote><P>
I hadn't chimed in because I've never tried merging the coverage report. But I can think of lots of situations where the environment will influence which code <I>can</I> be covered in a given environment, and thus will influence the test coverage report.<P>
Here are three examples:<P>
<c>
# the coverage report on MSWin32 will be different on Win10 from Ubuntu Linux.
# I assume the OP would like to merge the two reports to make sure that all the
# functions are covered at least once between the two (or more) different
# environments
if($^O eq 'MSWin32') {
run_this_function();
} else {
run_a_different_function();
}
# or
# the coverage report is different in the environment where
# MY_ENV_VAR is set true vs where it's false or undefined,
# and the OP would like to merge the two reports to make sure that all the
# functions are covered at least once between the two (or more) different
# environments
if( $ENV{MY_ENV_VAR} ) {
run_special_case();
}
# different parts of the code are covered depending on whether some other
# executable is found, so that it can be run
if( -x '/x/y/bin/my_executable' ) {
my $ret = qx(/x/y/bin/my_executable); # cannot run on system X, where repo is in /a/b/repo/run.pl, and /x/y/ hierarchy might not even exist!
... error processing ...
$some_outer_variable += $ret;
}
</c><P>
In all of these situations, on system X the coverage will show certain functions or blocks of code run, but others not; and system Y may have a different group of functions or blocks that are run. So for example, maybe each system can run the same 80% base coverage, but system X covers 5% of code blocks that cannot run on Y and system Y has 15% of code blocks that cannot run on X; the individual reports say 85% coverage on X and 95% coverage on Y, when in reality, together they make 100% coverage, but neither report shows that. So the OP is asking <I>how</I> to merge those so that they can tell whether or not all lines of code are covered <I>in at least one</I> of the test systems.<!-- Wiki2Monks {"version":1.16} -->
11133020
11133050