Open rainingmaster opened 2 years ago
@illicitonion I found you are professional in this project, hope you can give me some help when you free. Thanks!
Hi @rainingmaster - thanks for the detailed bug report!
I've tried reproducing, and have a few follow-up questions:
cargo build
and copying it from target/release, or by uncommenting assorted of the deps in the rust_static_library
target, building it with bazel, and copying it from bazel-out?Each of those re-builds I did with different deps lists produced a byte-for-byte identical library file, so I suspect just adding something to deps
isn't sufficient for what you're trying to reproduce...
One thing I will note is that I've found that if you just re-build the same stuff with coverage enabled, it will sometimes say no coverage information was found, but if you bazel clean --expunge
it will start working again... This feels like a wider bazel issue, rather than one specific to rules_rust.
Hi, @illicitonion Thanks for your response!
Yes, your understanding is correct, I am try to compare the difference between depend on difference rules. And the file test/lib/libmy_lib.a is come from cargo build
. You have a nice catch, the md5 of file test/lib/libmy_lib.a and the result of bazel coverage
is same, I didn't notice this before.
As my try, after run bazel clean --expunge
, the coverage still 0, you can check the file under test/coverage/index.html
, it should be always 0? I agree with you, there should be have some problem with coverage
in bazel.
Is this not a duplicate of https://github.com/bazelbuild/rules_rust/issues/690 (which might have been addressed by https://github.com/bazelbuild/rules_rust/pull/1324)?
Background
We have a c++ project, it can use bazel very well to help we manage the dependency and compilation process. We recently tried to introduce rust. First of all, rust will be used in test cases, but we found that it seems to be compatible with
bazel coverage
. So We hope we can found some help here.A small case
I have try to add a repo show my problem: https://github.com/rainingmaster/bazel_combine
Env
And this is the rules_rust's version
Details
I have test in these ways:
: gap_lib
only//test/lib/cargo:rand_core
onlyAnd only 1, 2 can generate coverage well, 3, 4 will run successfully, but lose the coverage data. And here is my command.
I think there should be some difference between build by bazel(and rules_rust) and local rustc, so here is more details:
Following are the verbose for situtation 2
Following are output with
--subcommand
in bazelIn fact I have try to use bazel's args and build with local rustc, to found the difference, but it is still work :(
Expectation
When I run with remote dependencies(or local dependencies), the coverage should be same with run without rust. I hope some one can help me with this problem. Thanks a lot!