-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Minor bugfixes to generate Gcov/Lcov branch coverage #11489
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
recheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to split this into two changes, and also add tests for each of the bugfixes.
...st/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/LcovPrinter.java
Outdated
Show resolved
Hide resolved
Replaced obsolete 'BA:' tag by 'BRDA:' to be able to generate a valid branch coverage report.
On taken indicator '-' the current implementation of the LcovParser was setting the branch as executed and tried to convert the sign '-' to a number. Doing so an exception was thrown. Just inverted the condition to fix the problem.
I know, one is the parsing and the other one the printing. Implementing tests will strongly combine these two, so I would suggest to keep it together. |
Unfortunately, I don't know the history of the BA lines, but I wouldn't be surprised if the tool just changed silently at some minor version. The coverage tools seem to have a habit of doing that. :-/ The change looks reasonable to me, but I didn't do a careful review of the tests, and I also didn't research the BA / BRDA thing. @meisterT can you take a look as well, or find someone to take a look? |
Sorry, I have no clue about this. |
Are there any other tools being used besides the lcov project ( How to proceed here? |
I think a couple tools use lcov internal output for further processing. Regardless, if lcov HEAD accepts this and doesn't accept or document BA, I think it's fine to change it to BRDA unconditionally. |
So, the
I think it's fine not to support an 8-year-old release at this point. |
@lberki doesn't seem to be very responsive. Lots of work to do? |
@@ -280,7 +248,7 @@ private boolean parseBRDALine(String line) { | |||
|
|||
boolean wasExecuted = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be deleted.
@@ -22,7 +22,7 @@ | |||
|
|||
static BranchCoverage create(int lineNumber, int nrOfExecutions) { | |||
return new AutoValue_BranchCoverage( | |||
lineNumber, /*blockNumber=*/ "", /*branchNumber=*/ "", nrOfExecutions); | |||
lineNumber, /*blockNumber=*/ "0", /*branchNumber=*/ "0", nrOfExecutions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the two numbers here valid GCC IDs?
Below in this file it says it should be -1 for non-gcc emitted coverage. I'm guessing that if we don't have the values present, it should be -1 and not 0?
Thank you for the change! I have a couple of nits. |
Actually hold on addressing my comments. A colleague has just told me that BA may be important internally. I will ping this again once I know more. |
@oquenchil any updates? It's been a week... |
The problem that we are facing with coverage is that we have quite the knowledge gap right now and not enough people. I'm trying to fill that gap but I have been very busy with other issues. The previous expert on coverage in the team told me that the BA line is important internally but they didn't remember why. I wrote an email today to reach out to 2 other people in the company that may have more context. I will ping this once they reply. |
Would it help if this change added support for BRDA lines without converting to or from BA lines? Would that be an option, @MichaelKlemm ? |
I asked this as well because from the reply I got yesterday it wasn't clear. If I cannot tell you for certain tomorrow, I will try importing this PR with the BA deletion anyway and then we might find out later in which way it was important. Meanwhile, @MichaelKlemm could you please address the 2 nits? |
Ok, I have more information now. We definitely have internal tools still reporting BA lines. But we will change that. Meanwhile, if you can change this PR to be able to parse BA lines and treat them as BRDA, then that should be enough not to break anything as far as I can tell. Thank you! |
What is the status of this PR? |
It doesn't look like the internal tools will be changed any time soon, so this PR should keep the BA lines. |
We're currently in the process of fixing issues around the handling of lcov; fixes to the parser are part of that, as is changing the generators to not output "BA" lines. Unfortunately we cannot remove support for BA lines yet as they are still used internally at Google. |
When using bazel to generate C++ branch coverage
BA
entries are created instead ofBRDA
lines. As far as theseBA
lines could not be used bygenhtml
, I changed it be processed asBRDA
. Doing so the program throws an exception because of the wrong condition, trying to convert a '-' to a number. Inverted this condition to have the correct behavior of '-' which meanswasExecuted = false
andexecutionCount = 0
.