#72 closed enhancement (fixed)
"gcov" Recipe Command for C/C++ Coverage Metrics Gathering
Reported by: | Chandler Carruth <chandlerc@…> | Owned by: | cmlenz |
---|---|---|---|
Priority: | minor | Milestone: | 0.6 |
Component: | Recipe commands | Version: | dev |
Keywords: | gcov coverage metric recipe command | Cc: | |
Operating System: |
Description
Provide a RecipeCommand for C/C++ coverage measuring. The "gcov" command, part of the GCC project, provides the following coverage metrics:
- Line coverage.
- Branch coverage.
- Call coverage.
At least the line coverage should be provided using the existing framework in Bitten. Other metrics would also be useful.
Attachments (5)
Change History (11)
comment:1 Changed 19 years ago by Chandler Carruth <chandlerc@…>
Changed 19 years ago by Chandler Carruth <chandlerc@…>
Working version of patch. Tested it on my system, got correct statistics back.
comment:2 Changed 19 years ago by cmlenz
- Milestone set to 0.6
That last patch looks pretty nice. Thanks!
comment:3 Changed 19 years ago by cmlenz
- Status changed from new to assigned
So gcov doesn't provide information about exactly which lines were executed, or does it?
Also, I think I'm going to remove the branch parsing from the patch before applying it. Currently it's just unused code.
comment:4 Changed 19 years ago by Chandler Carruth <chandlerc@…>
It can. you can have it generate a file describing the execution of each line, as well as the branches and calls for each line. =] I am not currently generating these files, but it would not be terribly difficult to restructure the calls to gcov in order to generate the files.
My question is: what does it gain you? and at what cost? I'm not sure i want to parse the 10s of 1000s of lines of code in my fairly small projects... Let me know however if this is a priority. I'll whip something together to generate and parse the files.
comment:5 Changed 19 years ago by cmlenz
I've just attached a cleaned up version of your patch (it removes the branch coverage stuff, which isn't being reported yet anyway). This also has a few unit tests. Can you please test the patch and let me know if it works for you?
On the topic of recording the exact lines covered in each file… the idea is that in the future, Bitten would provide an annotator for the Trac browser that would display the coverage in the file view. Obviously that feature isn't there yet, so the question was more out of curiosity, rather than implying that it would be needed for the <c:gcov> command now.
comment:6 Changed 19 years ago by cmlenz
- Resolution set to fixed
- Status changed from assigned to closed
Patch applied in [314].
Output from a run of "gcov" looks something like the below:
I would recommend counting all blocks not belonging to a system file. The pattern of simply looking for absolute paths should work to eliminate these.