diff options
author | 2016-04-13 09:51:25 +0000 | |
---|---|---|
committer | 2016-04-14 07:36:34 +0000 | |
commit | d232d2332c0f63e69ac2957caf2139c67be85d42 (patch) | |
tree | 202c4c750c8f1982dd574e5605e3158523689985 /src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java | |
parent | bbf59ed1be85354457ad1d8123cc1973aa3ba298 (diff) |
experimental UI: Keep track of completed tests
When running tests, a useful information to know is the number of tests
that have passed and failed already. Hence subscribe to the relevant events
and provide this information in the progress bar as well.
--
Change-Id: I6fabec3f4585500f096b820dbbd5e8e6897647fa
Reviewed-on: https://bazel-review.googlesource.com/#/c/3350
MOS_MIGRATED_REVID=119727962
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java index ef0afe2f7b..3085456ebf 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java @@ -21,11 +21,13 @@ import com.google.devtools.build.lib.buildtool.ExecutionProgressReceiver; import com.google.devtools.build.lib.buildtool.buildevent.BuildCompleteEvent; import com.google.devtools.build.lib.buildtool.buildevent.BuildStartingEvent; import com.google.devtools.build.lib.buildtool.buildevent.ExecutionProgressReceiverAvailableEvent; +import com.google.devtools.build.lib.buildtool.buildevent.TestFilteringCompleteEvent; import com.google.devtools.build.lib.pkgcache.LoadingPhaseCompleteEvent; import com.google.devtools.build.lib.skyframe.LoadingPhaseStartedEvent; import com.google.devtools.build.lib.skyframe.LoadingProgressReceiver; import com.google.devtools.build.lib.util.Clock; import com.google.devtools.build.lib.util.io.AnsiTerminalWriter; +import com.google.devtools.build.lib.view.test.TestStatus.BlazeTestStatus; import java.io.IOException; import java.util.ArrayDeque; @@ -53,6 +55,9 @@ class ExperimentalStateTracker { private final Map<String, Long> actionNanoStartTimes; private int actionsCompleted; + private int totalTests; + private int completedTests; + private int failedTests; private boolean ok; private ExecutionProgressReceiver executionProgressReceiver; @@ -156,6 +161,20 @@ class ExperimentalStateTracker { } } + public void testFilteringComplete(TestFilteringCompleteEvent event) { + if (event.getTestTargets() != null) { + totalTests = event.getTestTargets().size(); + } + } + + public synchronized void testSummary(TestSummary summary) { + completedTests++; + if (summary.getStatus() != BlazeTestStatus.PASSED) { + failedTests++; + } + } + + /*** * Predicate indicating whether the contents of the progress bar can change, if the * only thing that happens is that time passes; this is the case, e.g., if the progress @@ -201,6 +220,13 @@ class ExperimentalStateTracker { } else { terminalWriter.okStatus().append("Building:"); } + if (completedTests > 0) { + terminalWriter.normal().append(" " + completedTests + " / " + totalTests + " tests"); + if (failedTests > 0) { + terminalWriter.append(", ").failStatus().append("" + failedTests + " failed").normal(); + } + terminalWriter.append(";"); + } if (runningActions.size() == 0) { terminalWriter.normal().append(" no actions running"); } else if (runningActions.size() == 1) { |