diff options
author | 2017-02-16 13:43:51 +0000 | |
---|---|---|
committer | 2017-02-16 16:56:03 +0000 | |
commit | 45282686be49297b3e910f8876a28dc0e9eeef5d (patch) | |
tree | df987ffe59fe80216dbbbc6708c03091c4520df1 /src/main/java/com/google/devtools/build/lib/runtime | |
parent | 686fde1b1aeb4e5d03dca7446cf39cd9f1114d79 (diff) |
Ensure test results are also reported for cached test
When a test is not run, because it was cached, we still expect the test to
be reported and to find a test log reported in the build-event protocol.
--
Change-Id: I806c757cdf8f46a5b687d29dec31ad4a289c4097
Reviewed-on: https://cr.bazel.build/8931
PiperOrigin-RevId: 147710591
MOS_MIGRATED_REVID=147710591
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/AggregatingTestListener.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/AggregatingTestListener.java b/src/main/java/com/google/devtools/build/lib/runtime/AggregatingTestListener.java index c57373c505..a9415b2ced 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/AggregatingTestListener.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/AggregatingTestListener.java @@ -36,11 +36,11 @@ import com.google.devtools.build.lib.buildtool.buildevent.BuildInterruptedEvent; import com.google.devtools.build.lib.buildtool.buildevent.TestFilteringCompleteEvent; import com.google.devtools.build.lib.concurrent.ThreadSafety; import com.google.devtools.build.lib.events.ExceptionListener; +import com.google.devtools.build.lib.rules.test.TestAttempt; import com.google.devtools.build.lib.rules.test.TestProvider; import com.google.devtools.build.lib.rules.test.TestResult; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.lib.view.test.TestStatus.BlazeTestStatus; - import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -123,6 +123,12 @@ public class AggregatingTestListener { LabelAndConfiguration targetLabel = LabelAndConfiguration.of( testOwner.getLabel(), result.getTestAction().getConfiguration()); + // If a test result was cached, then no attempts for that test were actually + // executed. Hence report that fact as a cached attempt. + if (result.isCached()) { + eventBus.post(TestAttempt.fromCachedTestResult(result)); + } + TestSummary finalTestSummary = null; synchronized (summaryLock) { TestSummary.Builder summary = summaries.get(targetLabel); |