Code Coverage Tool Reference Manual
Interpreting the Code Coverage Report
HP Code Coverage Tool Reference Manual for HP Integrity NonStop NS-Series Servers—542684-004
7-6
Understanding Color Coding in the Code Coverage
Report
The count, specifically, the caret (^), appears directly under the point where codecov
“thinks” the block begins. For example:
This procedure was executed, so it should have been uncolored. However, the int at
the beginning of the line is shown as partially covered (light brown).The report also
indicates that the first block generated for the line starts with gethost, and was
executed twice. You might expect that the entire line would be given the same color
(no color). However, the color coding for this line shows the portion of the line starting
with gethost as uncolored; int has a color inherited from previous lines.
As explained in Understanding Code Coverage Concepts on page 3-2, control flow
structures, such as if and return statements, can result in multiple blocks.
Moreover, multiple blocks can have the same source code location, with some blocks
covered and others not. These source code locations are considered to be “partially
covered.” You can eliminate this potential source of confusion by specifying the
-nopartial option, which specifies that if multiple basic blocks are generated for a
single source position, codecov should consider them all to be covered if any one of
them was covered.
When -nopartial is specified, you can still use the -counts option to obtain
information about blocks. Consider the following example of a partial codecov output:
The count of 14 below the call to Func indicates that the while loop was executed 14
times. Since that is the only point within the loop that shows a count, that means that
the entire body of the loop generated a single block. However, the notation 28(3)
indicates that three other blocks were generated for the line containing the while
statement, and collectively, those three blocks were executed 28 times and that each
block was executed at least once. (When just a single value, such as (3), and not two
values separated by a slash, such as (1/3), is shown in parentheses, that means that
either all blocks were executed or none were executed.) You cannot determine from
these values how many times each block was executed.
int gethostsex (void) {
^ 2
while (i < 14)
^28(3)
{
Func(i);
^14
++9i;
}










