rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Only add coverage instrumentation to tests

Open neilisaac opened this issue 1 year ago • 1 comments

Linking a rust_shared_library with ld.gold fails when building a rust_shared_library that exposes FFI bindings used in a coverage build of a test written in another language.

neilisaac avatar Jul 26 '23 13:07 neilisaac

Could you provide a minimal example where this reproduces and/or add a regression test for this? How does the linking fail exactly?

It feels like this PR will disable coverage collection of rust dependencies of a rust test, which seems wrong. Also, I'd expect for coverage to be able to work across at least C++ and rust whenever the toolchain definitions are compatible, e.g.: running with coverage a cc_test that depends on a rust_library should be able to produce coverage information from the rust sources.

Since shared libraries are tricky and intended for interfacing with other languages that may have incompatible coverage support, a possibility would be to disable coverage instrumentation just for the rust_shared_library crate types themselves.

krasimirgg avatar Jul 28 '23 09:07 krasimirgg