-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
bazel 5 coverage --combined_report=lcov
executes incompatible actions
#15385
Comments
@gregestren , FYI. When I next have some free time I'll work on fixing this before the refactor. This is stopping us from upgrading. |
I should clarify that this didn't happen in 4.2.2: $ bazel --nohome_rc coverage //:all --javabase=@bazel_tools//tools/jdk:remote_jdk11 --combined_report=lcov
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/home/pschrader/.bazelrc
INFO: Using default value for --instrumentation_filter: "^//".
INFO: Override the above default with --instrumentation_filter
INFO: Build options --java_runtime_version and --javabase have changed, discarding analysis cache.
ERROR: Cannot generate coverage report - no coverage information was collected
INFO: Analyzed 2 targets (4 packages loaded, 405 targets configured).
INFO: Found 1 target and 1 test target...
INFO: Elapsed time: 3.302s, Critical Path: 0.05s
INFO: 2 processes: 1 internal, 1 linux-sandbox.
INFO: Build completed successfully, 2 total actions
//:example_test SKIPPED
INFO: Build completed successfully, 2 total actions |
This bug affects my organization, we might have to downgrade to 4.2. I just checked and the issue is in 5.0.0 as well, it's not really a "5.1" bug as it says in the title. But I haven't tracked further than that to find a specific commit. |
If you compile your own version, I think you can use this as a quick hack to work around the issue: diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
index 581a655a65..67afcb3ab0 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
@@ -531,8 +531,9 @@ public class BuildView {
Set<ConfiguredTarget> allTargetsToTest = null;
if (testsToRun != null) {
- // Determine the subset of configured targets that are meant to be run as tests.
+ // Determine the subset of compatible configured targets that are meant to be run as tests.
allTargetsToTest = filterTestsByTargets(configuredTargets, testsToRun);
+ allTargetsToTest.removeAll(targetsToSkip);
}
ImmutableSet.Builder<Artifact> artifactsToBuild = ImmutableSet.builder(); The problem is that this approach doesn't pass the skipped targets information to the final test reporter ( |
coverage --combined_report=lcov
executes incompatible actionscoverage --combined_report=lcov
executes incompatible actions
Thanks for the update! I don't think it's likely I can get go-ahead on deploying an inofficial Bazel version internally but it's good to hear that this is being worked on and that the problem is understood. Do you think a fix will be added to a 5.1.2 release in the near future (say, a couple of weeks)? |
I'll start investigating to identify the cause, but I can't judge on the time to fix just yet. |
I would like to understand the regression better before judging a fix. Bisecting indicates that 5b216b2 triggered the regression (the flag flip for Unfortunately the flag was removed in 5.0, so there's no way of disabling this behaviour in that version. This wouldn't be the first time the change activated by that flag has broken something, but at least this gives an indication of where something might be going wrong. FWIW, the provided reproduction only starts passing properly after ed01f42 (bisecting between 4.0.0 and 4.2.0). |
So the cause of the regression is straight-forward. When 21179b2 added the check that forwards an This trips up the coverage code down the line. The fix could either be what you've done in #15419 or to change the check in I think I prefer the former as it strikes me as a little more "robust". |
Before this patch we see coverage trying to execute incompatible tests. This results in `Can't build this. This target is incompatible` messages. Instead, those tests should just be skipped. This patch makes it so the coverage code only tries to collect coverage artifacts for compatible tests. Artifacts for incompatible tests are ignored. Fixes bazelbuild#15385 Closes bazelbuild#15419. PiperOrigin-RevId: 447710011 (cherry picked from commit 2f1ff6f)
Before this patch we see coverage trying to execute incompatible tests. This results in `Can't build this. This target is incompatible` messages. Instead, those tests should just be skipped. This patch makes it so the coverage code only tries to collect coverage artifacts for compatible tests. Artifacts for incompatible tests are ignored. Fixes bazelbuild#15385 Closes bazelbuild#15419. PiperOrigin-RevId: 447710011 (cherry picked from commit 2f1ff6f)
Before this patch we see coverage trying to execute incompatible tests. This results in `Can't build this. This target is incompatible` messages. Instead, those tests should just be skipped. This patch makes it so the coverage code only tries to collect coverage artifacts for compatible tests. Artifacts for incompatible tests are ignored. Fixes #15385 Closes #15419. PiperOrigin-RevId: 447710011 (cherry picked from commit 2f1ff6f) Co-authored-by: Chenchu Kolli <ckolli@google.com>
Description of the bug:
Running
bazel coverage --combined_report=lcov
does not properly skip incompatible tests.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
BUILD file:
Empty WORKSPACE file.
Which operating system are you running Bazel on?
x86 Ubuntu 18.04
What is the output of
bazel info release
?release 5.1.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.N/A
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?Have you found anything relevant by searching the web?
I couldn't find a similar bug report.
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: