bazel: `bazel coverage` fails over remote ex for java_test
Description of the problem / feature request:
Tooling for coverage fails when running under remote execution (LcovMerger specifically)
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Run a test target with bazel coverage --spawn_strategy=remote --remote_executor=... //path/to:test
What operating system are you running Bazel on?
Ubuntu 14.04
What’s the output of bazel info release
?
release 0.10.1
Any other information, logs, or outputs that you want to share?
Relevant portion of coverage execution
+ exec bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/test/LcovMerger --coverage_dir=%execroot%/_coverage/path/to/test/test --output_file=%execroot%/bazel-out/k8-fastbuild/testlogs/path/to/test/coverage.dat
%execroot%/bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/test/LcovMerger: Cannot locate runfiles directory. (Set $JAVA_RUNFILES to inhibit searching.)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 71 (52 by maintainers)
Commits related to this issue
- Delegate coverage tools to @remote_coverage_tools Requires: - #10379 is merged - a new remote coverage tools zip pushed - coverage.WORKSPACE updated to the new tools This changes the @bazel_tools... — committed to ulfjack/bazel by ulfjack 5 years ago
- Delegate coverage tools to @remote_coverage_tools Requires: - #10379 is merged - a new remote coverage tools zip pushed - coverage.WORKSPACE updated to the new tools This changes the @bazel_tools... — committed to ulfjack/bazel by ulfjack 5 years ago
- Add aliases for :lcov_merger and :coverage_report_generator targets Currently, the coverage tool setup is smeared across @bazel_tools//tools/test/BUILD, @bazel_tools//tools/test/CoverageOutputGenerat... — committed to bazelbuild/bazel by ulfjack 5 years ago
- Update to new coverage tools release Progress on #4685. Closes #10393. Change-Id: I2cb5f90c75e341419bb05d035b0ae1cc26a5eba5 PiperOrigin-RevId: 284764946 — committed to bazelbuild/bazel by ulfjack 5 years ago
- Delegate coverage tools to @remote_coverage_tools Requires: - #10379 is merged - a new remote coverage tools zip pushed - coverage.WORKSPACE updated to the new tools This changes the @bazel_tools... — committed to bazelbuild/bazel by ulfjack 5 years ago
- Java: depend on lcov merger as host The lcov merger tool used in coverage by Bazel was being depended on in the target configuration from the Java test rules instead of the host configuration. This m... — committed to bazelbuild/bazel by oquenchil 4 years ago
- Java: depend on lcov merger as host The lcov merger tool used in coverage by Bazel was being depended on in the target configuration from the Java test rules instead of the host configuration. This m... — committed to Yannic/bazel by oquenchil 4 years ago
- Fix bazel coverage build on Jenkins Summary: Coverage runs were getting `nobuild_runfile_links` from a expansion of `remote_download_minimal`. This happens to cause issues. So explicitly set `build_r... — committed to pixie-io/pixie by vihangm 2 years ago
- Fix bazel coverage build on Jenkins Summary: Coverage runs were getting `nobuild_runfile_links` from a expansion of `remote_download_minimal`. This happens to cause issues. So explicitly set `build_r... — committed to orishuss/pixie by vihangm 2 years ago
- Fix bazel coverage build on Jenkins Summary: Coverage runs were getting `nobuild_runfile_links` from a expansion of `remote_download_minimal`. This happens to cause issues. So explicitly set `build_r... — committed to orishuss/pixie by vihangm 2 years ago
- Fix bazel coverage build on Jenkins Summary: Coverage runs were getting `nobuild_runfile_links` from a expansion of `remote_download_minimal`. This happens to cause issues. So explicitly set `build_r... — committed to orishuss/pixie by vihangm 2 years ago
I’m working on this. Hopefully, I have a fix soon.
@SimonVleugels - Looks like the patch I originally created it has been changed slightly. I haven’t had time to check but I can try and take a look later: https://github.com/bazelbuild/bazel/blob/5.0.0/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java#L593
Ulf, do you plan to do anything here?
As a workaround, you can do the following (currently requires Bazel built from HEAD):
Alternatively, you can pull back the full coverage outputs and manually post-process them:
The downside of this second approach is that it also pulls back a bunch of (potentially) large, unnecessary files.
I was just hoping to not have to to pass
--test_env=LCOV_MERGER=/bin/true
.Why the reluctance? Wouldn’t adding the coverage binary properly as a tool to the test action (i.e., fix #4033) be the cleanest resolution?