-
Notifications
You must be signed in to change notification settings - Fork 633
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
Add support for "Coverage profiling support for integration tests" #3513
Comments
This is definitely something I would like to see, but it requires some work: Since we interface with Go on a lower level than If anyone wants to work on this, I can offer my help. I am also in touch with the Go team and hope that they can provide some pointers. |
Leaving some pointers here for anybody who is interested in picking this up. Exit hooks can be realized with https://github.com/golang/go/blob/8edcdddb23c6d3f786b465c43b49e8d9a0015082/src/runtime/coverage/hooks.go#L42. |
Thanks for the quick response, Fabian! I hope some ambitious gopher takes you up on your offer. |
Adding info I received from @thanm:
|
I'm very interested in this functionality as well. I'd like to add that for our purposes, we would like the ability to perform normal compilation steps with the equivalent of "go build -cover -coverpkg /...." available - we don't want this integrated with existing "bazel coverage" runs, because the whole point of this new feature is to allow running integration tests while gathering coverage information. Integration testing would not normally be driven by bazel. Hopefully that is something that will come out of this effort as well. Thanks! |
It seems like golang/go#55953 was pushed to 1.23 so we can still use the old coverage for 1.22. But we should start floating some design ideas for this so that we could have something 6 months from now. |
In 1.20, Go introduced support for integration test profiling: https://go.dev/testing/coverage/#gomodselect. Can support for this be added to rules_go so that coverage is collected from Go binaries executed during
bazel coverage
?My use case: I've got go_test rules that depend on go_binary artifacts via the
data
attribute. The tests run the binaries using exec.Command. I'd like to aggregate test coverage from my code included in the binary under test.Can I tell bazel coverage to set the -cover flag on any go_binary rules invoked and have it aggregate coverage?
Here's an example I'd like to work with:
bazel coverage --combined_report=lcov //my_test
I'd expect the resulting coverage to include coverage for
my_binary_under_test.go
as it's used in my_binary_under_test which is invoked by my_test.The text was updated successfully, but these errors were encountered: