question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class name invalid for gcov parser

See original GitHub issue

Describe the bug When I use ReportGenerator to convert a gcov report to a cobertura report, the file path is not stripped from the class name.

To reproduce

  1. Generate a coverage file with lcov. test_coverage.info with contents like
...
TN:
SF:/home/agent/src/internal/MasterInternal.h
DA:10,0
DA:24,0
end_of_record
...
  1. Invoke ReportGenerator like this ReportGenerator -reports:./test_coverage.info -sourcedirs:/home/agent/src -targetdir:./Results/ -reporttypes:Cobertura

  2. Take a look at the generated ./Results/Cobertura.xml file:

<class name="/home/agent/src/internal/MasterInternal.h" filename="/home/agent/src/internal/MasterInternal.h" line-rate="1" branch-rate="1" complexity="NaN">
    ....
</class>
  1. The expected output should be:
<class name="MasterInternal.h" filename="/home/agent/src/internal/MasterInternal.h" line-rate="1" branch-rate="1" complexity="NaN">
    ....
</class>

Why is this a problem? I later merge reports together using ReportGenerator with -reporttypes:HtmlInline_AzurePipelines. Classnames containing a path like this, are not correctly rendered in the report.

Possible Fix https://github.com/danielpalme/ReportGenerator/blob/main/src/ReportGenerator.Core/Parser/GCovParser.cs#L89 ~var @class = new Class(fileName, assembly);~ var @class = new Class(className, assembly);

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
t-moecommented, May 18, 2022

Now it works ☺️ . Thank you.

1reaction
t-moecommented, May 16, 2022

Fantastic work. Thank you so much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gcovr fails with GCC 8.0.1 · Issue #226
These changes are good, but break our current parser in many ways. Here is an excerpt of such a .gcov file from their...
Read more >
gcov reporting wrong result for header only class
As it seems the problem wasn't the fact that my class is header only but that I called gcov with. gcov unittest_myclass.cpp -o...
Read more >
Gcovr User Guide — gcovr 4.2 documentation
Gcovr provides a utility for managing the use of the GNU gcov utility and generating summarized code coverage results. This command is inspired...
Read more >
gcovr Documentation
Gcovr provides a utility for managing the use of the GNU gcov utility and generating summarized code coverage results. This command is inspired ......
Read more >
Change Log — gcovr 6.0+master documentation
The exit code for an error of the reader module is changed from 8 to 64 ... (#%s687); Accept NAN % which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found