-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
runtime/coverage: covcounters not written in -buildmode=c-shared #64371
Comments
CC @thanm. |
Thanks for the report. If you could please post a complete example, that would be helpful. In particular, does your example program invoke |
No, it can't. The program loads the Go shared library is a C++ program, so it won't invoke
It is a Go plugin running inside Envoy: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/golang_filter.html#golang. It would require knowledge about Envoy (a network proxy) to run the example. I am glad to give you help if you need. |
Thanks for that. Given that the Go code is running as a plugin of some sort and is only invoked at the behest of the main process, and isn't being notified when the program terminates, how exactly would you imagine it would be possible to write out coverage counters? Unless the Go runtime within the plugin has some idea that the program is complete, it doesn't seem as though there's much the runtime can do. I think this is a case where it needs a bit of help from the main program, would you not agree? |
Thanks for your reply. |
Go version
go version go1.21.4 linux/arm64
Reproducibility
What operating system and processor architecture are you using (
go env
)?What did you do?
CGO_ENABLED=1 go build -cover --buildmode=c-shared -o libgolang.so
.libgolang.so
.What did you expect to see?
Both covmeta and covcounters file should be generated.
What did you see instead?
Only covmeta file is generated.
Look like when Go code runs as a shared library, the covcounters file is not flushed when the host process exits.
Currently, I work around this by calling
coverage.WriteCounters
manually.The text was updated successfully, but these errors were encountered: