Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method level coverage in the xml generated #654

Open
ybagarka1 opened this issue Aug 8, 2022 · 7 comments
Open

Method level coverage in the xml generated #654

ybagarka1 opened this issue Aug 8, 2022 · 7 comments
Labels
Format: Cobertura help wanted not possible for now This feature is not possible because of restrictions from other ones Type: Enhancement

Comments

@ybagarka1
Copy link

Issue:

The xml file generated from gcovr is not having method/function level coverage.

<class branch-rate="0.285714285714" complexity="0.0" filename="src/absc/mno/xyz/ahgs.cpp" line-rate="0.231481481481" name="os_clib_hxx">
<methods/>
<lines>
<line branch="false" hits="0" number="200"/>
<line branch="false" hits="0" number="202"/>
<line branch="false" hits="3" number="208"/>
<line branch="false" hits="3" number="210"/>
<line branch="false" hits="63" number="213"/>
<line branch="true" condition-coverage="50% (1/2)" hits="63" number="215">
<conditions>
<condition coverage="50%" number="0" type="jump"/>
</conditions>
</line>
<line branch="false" hits="0" number="218"/>
.........
..........

Expected:

Function level coverage to be visible in xml

@ybagarka1
Copy link
Author

@Spacetown thanks for considering this in the upcoming release. It will be a good enhancement to have. Any timelines for the upcoming release ?

@Spacetown
Copy link
Member

No timeline yet. 😄

@ybagarka1
Copy link
Author

@Spacetown #655 - this did the trick. I am able to view the method level in the xml.

@Spacetown
Copy link
Member

Spacetown commented Aug 10, 2022

@ybagarka1 But are the values correct?
@latk What do you think about the code to get the lines which belong to a function? I was thinking about adding this functionality to coverage.py. A function like

def splitFunctions(data: FileCoverage) -> List(FileCoverage):

@latk
Copy link
Member

latk commented Aug 11, 2022

@Spacetown I think that runs into the problems of nested functions, as outlined in my PR review. In addition to the nested function concern, I'm also not sure how that would deal with static initialization:

int foo() { ... }

int variable = initialization_function();

I think we remove compiler-generated functions like initializers/“constructors”, which would stand in the way of proper attribution of lines to functions.

@Spacetown
Copy link
Member

As mentioned in #655 this is not possible yet.

@Spacetown
Copy link
Member

The data model now contains the branch rate stated by gcov but since the line rate is also required it's still not possible.

@Spacetown Spacetown added the not possible for now This feature is not possible because of restrictions from other ones label Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: Cobertura help wanted not possible for now This feature is not possible because of restrictions from other ones Type: Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants