util/collect_coverage: Allow overriding TARGET_FILE#3808
util/collect_coverage: Allow overriding TARGET_FILE#3808akhramov wants to merge 1 commit intobazelbuild:mainfrom
Conversation
Currently, the instrumented binary is sourced from the `TARGET_FILE` environment variable. For wrappers around `rust_test`, this variable points to the wrapper rather than the actual binary, which breaks code coverage. This change: * Introduces the `RULES_RUST_TEST_BINARY_OVERRIDE` environment variable, which wrapper authors can use to supply the path to the original test binary. * Uses the runfiles library to resolve `runfiles_dir` instead of relying solely on the `RUNFILES_DIR` variable.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
UebelAndre
left a comment
There was a problem hiding this comment.
Thanks! But I'm confused at what this change does. Is RUNFILES_DIR not reliable? And what is the use of the override?
|
Thanks for looking. I owe you a repro on bot of these. Will come up with one soon. In short,
in our setup
Wrapper scripts have TARGET_FILE set to the wrapper, not the wrapee, so the script passes the wrong path to |
Currently, the instrumented binary is sourced from the
TARGET_FILEenvironment variable. For wrappers aroundrust_test, this variable points to the wrapper rather than the actual binary, which breaks code coverage.This change:
Introduces the
RULES_RUST_TEST_BINARY_OVERRIDEenvironment variable, which wrapper authors can use to supply the path to the original test binary.Uses the runfiles library to resolve
runfiles_dirinstead of relying solely on theRUNFILES_DIRvariable.