-
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
Enable coverage for generated source files #11350
Conversation
Please create an issue for this first so more people can review the relative merits of the feature and if/how it should be done. I strongly suspect that this change would be contentious as is. |
+1 I think this would be interesting for our use case, but I'm not sure we'd want it by default, and ideally there would be some way to disable it. |
Created the issue #11375 |
Also reported on Slack: https://bazelbuild.slack.com/archives/CA31HN1T3/p1588710579121400 |
+1 This is essential for coverage to work; this should absolutely be enabled by default. Maybe it is a bug in isSourceArtifact, but I think that check is not needed. Currently this blocks us using the Bazel release as-is |
@meteorcloudy @c-mita @meisterT is it possible to merge this? It has passed 13 months for a one-line review. |
I'm wary of merging, at least right now. Internally, we have tools that expect to be able to open files referenced in coverage reports which would not be possible if they don't exist in the repo. Either we would need to guard this feature behind a yet-another-flag or any such tool has to be able to handle files not existing in the repo. |
I get it.. but this sounds like a report generator issue, not that the coverage data should avoid source files. That seems dangerous to me. We do extra filtering on the coverage.dat file to e.g. exclude parts of debug frameworks, but that is an intermediate step, and not something we would consider on the raw output. |
@c-mita Can this be closed? |
Not quite; I want to check what happens with proto_library in the new year before it's dismissed. There was interest expressed in this PR to me at Bazelcon. |
I can also say that this would be interesting for us. |
I can imagine supporting this feature under an experimental flag for the moment; the cost to doing so doesn't seem high to me. |
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.
Guard with an experimental flag (e.g. --experimental_collect_coverage_for_generated_files).
@c-mita are you waiting for a user response, if so can you change the label from awaiting-review to awaiting-user-response to reflect that? |
Currently generated source files can't be included in the coverage report. Remove the check to enable coverage for the generated files.
@c-mita I added the experimental flag as per review comments |
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.
LGTM.
I was going to ask for a test, but in investigating how best to do it, I ended up writing it so I'll just add it in myself when I import.
@c-mita Not entirely sure whether it's relevant for this particular flag, but this may lack a line in |
I don't that matters since, AFAIU, this shouldn't be carried over to the exec configuration. The other coverage flags aren't carried over either. |
Actually, i couldn't even ask you to write tests; the tests for InstrumentedFilesCollector haven't been open-sourced for some reason... |
Hi @c-mita, Since I can see that this PR has been approved, please let me know whether I should proceed with importing it. Thanks! |
I've done the import myself and it's currently undergoing internal review. |
@c-mita could you please provide an update on this? Is it still under internal review? Thanks |
There were some discussions internally and a little bit of push-back regarding the addition of a new flag. Then it sort of just fell through the cracks; sorry about that. If there are no issues, then we may want to push for enabling this all the time and removing the flag. |
Thank you! Is there any work needed to get this in the upcoming Bazel 6.3 release? |
@bazel-io fork 6.3.0 |
Closes bazelbuild#11350. RELNOTES: Add flag --experimental_collect_code_coverage_for_generated_files. PiperOrigin-RevId: 539648731 Change-Id: I352de7a74c522db6fbe5e10a21268914d1e39d58
@UebelAndre Here is the PR to push this change to the 6.3.0 just for your reference: #18664 Also, just for your reference, here is the list of the issues/PR's that shall be resolved for the 6.3.0 release: https://github.com/bazelbuild/bazel/milestone/53 Thanks |
Closes #11350. RELNOTES: Add flag --experimental_collect_code_coverage_for_generated_files. PiperOrigin-RevId: 539648731 Change-Id: I352de7a74c522db6fbe5e10a21268914d1e39d58 Co-authored-by: Rasrack <[email protected]>
Closes bazelbuild#11350. RELNOTES: Add flag --experimental_collect_code_coverage_for_generated_files. PiperOrigin-RevId: 539648731 Change-Id: I352de7a74c522db6fbe5e10a21268914d1e39d58
Currently generated source files can't be included in the coverage report. Remove the check to enable coverage for the generated files.