lcov
lcov copied to clipboard
Confused with branch coverage
Hi, I would like to ask, if there is a way to do properly only conditional branch coverage with LCOV/GCOV.
I found this simple project which is showing the problem: https://github.com/ghandmann/lcov-branch-coverage-weirdness
There is also some thread about this problem: https://stackoverflow.com/questions/42003783/lcov-gcov-branch-coverage-with-c-producing-branches-all-over-the-place
I can't use -fno-exceptions
flag, so I would like to know if there is any solution for this problem.
Thanks in advance for your help.
With the solution proposed in Pull Request #80 you can exclude exception branches from branch coverage, which will reduce a lot the coverage errors in the report.
You could try the version from the PR with your code to check if it has the expected results.
Hi @jgonzalezdr, Have you progressed ? Will be your pull request merged with master ?
Thanks in advance for your answer.
Hi @jgonzalezdr, I have tried your solution from Pull Request #80 on this simple project: https://github.com/ghandmann/lcov-branch-coverage-weirdness
Result before using your solution:
Result after using your solution:
Some branch coverage errors in the report are reduced, but the main error caused by the std namespace is still there. Any ideas ?
Thanks in advance for your help
PR #116 contains a partial fix for this issue (see "--filter branch). There is a discussion in various places about why that could be considered a hack - and does not completely address the issue. Unfortunately - given the way that lcov works, the underlying issue is not one that can be solved by lcov (need compiler/tool chain support).
There are a few other issue requests about branch coverage strangeness. The specific issues mentioned here are addressed in SHA 5f659f63801e, I think. Could you try your actual code with the current TOT to see if issues remain?
I fear that any issues that do remain might be very hard to fix given the filtering approach that I took, and the lack of real compiler infrastructure in lcov. (That lack is likely never going to be fixed.)
You will have to decide if your issue is resolved or not :-)
Henry
6 months with no update or further comments. I believe this issue is addressed - so closing it.
If there is still a problem, please reopen this issue or file a new issue. Please provide a detailed description of the problem you see and ideally also provide a small testcase which illustrates the issue. Henry