bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Enable coverage for generated source files

Open Rasrack opened this issue 4 years ago • 11 comments

Currently generated source files can't be included in the coverage report. Remove the check to enable coverage for the generated files.

Rasrack avatar May 11 '20 08:05 Rasrack

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.

aiuto avatar May 13 '20 04:05 aiuto

+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.

keith avatar May 13 '20 04:05 keith

Created the issue #11375

Rasrack avatar May 13 '20 04:05 Rasrack

Also reported on Slack: https://bazelbuild.slack.com/archives/CA31HN1T3/p1588710579121400

jin avatar May 14 '20 03:05 jin

+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

ozio85 avatar Nov 03 '21 10:11 ozio85

@meteorcloudy @c-mita @meisterT is it possible to merge this? It has passed 13 months for a one-line review.

ozio85 avatar Nov 03 '21 10:11 ozio85

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.

c-mita avatar Nov 03 '21 11:11 c-mita

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.

ozio85 avatar Nov 03 '21 13:11 ozio85

@c-mita Can this be closed?

oquenchil avatar Dec 16 '22 10:12 oquenchil

@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.

c-mita avatar Dec 16 '22 11:12 c-mita

I can also say that this would be interesting for us.

limdor avatar Dec 16 '22 16:12 limdor

I can imagine supporting this feature under an experimental flag for the moment; the cost to doing so doesn't seem high to me.

c-mita avatar Jan 20 '23 15:01 c-mita

@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?

oquenchil avatar Feb 03 '23 09:02 oquenchil

@c-mita I added the experimental flag as per review comments

Rasrack avatar Mar 11 '23 16:03 Rasrack

@c-mita Not entirely sure whether it's relevant for this particular flag, but this may lack a line in CoreOptions#getExec to carry it over to the exec configuration.

fmeum avatar Mar 17 '23 09:03 fmeum

@c-mita Not entirely sure whether it's relevant for this particular flag, but this may lack a line in CoreOptions#getExec to carry it over to the exec configuration.

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.

c-mita avatar Mar 17 '23 09:03 c-mita

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.

Actually, i couldn't even ask you to write tests; the tests for InstrumentedFilesCollector haven't been open-sourced for some reason...

c-mita avatar Mar 17 '23 12:03 c-mita

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!

sgowroji avatar Mar 24 '23 08:03 sgowroji

I've done the import myself and it's currently undergoing internal review.

c-mita avatar Mar 24 '23 10:03 c-mita

@c-mita could you please provide an update on this? Is it still under internal review? Thanks

limdor avatar May 15 '23 19:05 limdor

@c-mita @lberki friendly ping 😄

UebelAndre avatar Jun 11 '23 18:06 UebelAndre

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.

c-mita avatar Jun 12 '23 14:06 c-mita

Thank you! Is there any work needed to get this in the upcoming Bazel 6.3 release?

UebelAndre avatar Jun 12 '23 14:06 UebelAndre

@bazel-io fork 6.3.0

c-mita avatar Jun 12 '23 15:06 c-mita

Thank you! Is there any work needed to get this in the upcoming Bazel 6.3 release?

@UebelAndre Here is the PR to push this change to the 6.3.0 just for your reference: https://github.com/bazelbuild/bazel/pull/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

iancha1992 avatar Jun 13 '23 21:06 iancha1992