diff options
author | Klaus Aehlig <aehlig@google.com> | 2016-06-20 15:32:10 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2016-06-21 09:58:00 +0000 |
commit | f7ee9885f844b17da1e83c81e6479b5bbb9857e5 (patch) | |
tree | f25ec5aeb8c942a2c84e14ecbe9bdcdb3ed151b3 /src/main | |
parent | 480ac15266224feaf5f1aa3a0a36e5f3e4602881 (diff) |
experimental UI: be less verbose about test summaries
To keep the noise of messages in the scroll-back buffer low, limit
which test summaries are shown there.
- If a test fails to build, the error message about the build failure
is already in the scroll-back buffer---and more useful to the user
anyway.
- If a test is not run (either because the user interrupted the build,
or because of a build error), then either the user is aware of it
anyway or the information about the build failure is present and
more useful. Also, this is only detected at the end of the build,
were a summary of the tests is shown; hence avoid duplication here.
- If a test has status failed and there is precisely one failure log,
then the summary does not provide any useful information compared
to the individual FAIL message in the scrollback buffer.
While there, also show the precise status of the summary.
--
Change-Id: I13665db24f956c8d8b651dc38859649085b8bbcf
Reviewed-on: https://bazel-review.googlesource.com/#/c/3830
MOS_MIGRATED_REVID=125339810
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java index 99b92fc841..6ad3e531d0 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.runtime; +import com.google.common.collect.ImmutableSet; import com.google.common.eventbus.Subscribe; import com.google.common.primitives.Bytes; import com.google.devtools.build.lib.actions.ActionCompletionEvent; @@ -297,15 +298,38 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler { refresh(); } + /** + * Return true, if the test summary provides information that is both + * worth being shown in the scroll-back buffer and new with respect to + * the alreay shown failure messages. + */ + private boolean testSummaryProvidesNewInformation(TestSummary summary) { + ImmutableSet<BlazeTestStatus> statusToIgnore = + ImmutableSet.of( + BlazeTestStatus.PASSED, + BlazeTestStatus.FAILED_TO_BUILD, + BlazeTestStatus.BLAZE_HALTED_BEFORE_TESTING, + BlazeTestStatus.NO_STATUS); + + if (statusToIgnore.contains(summary.getStatus())) { + return false; + } + if (summary.getStatus() == BlazeTestStatus.FAILED && summary.getFailedLogs().size() == 1) { + return false; + } + return true; + } + @Subscribe public synchronized void testSummary(TestSummary summary) { stateTracker.testSummary(summary); - if (summary.getStatus() != BlazeTestStatus.PASSED) { + if (testSummaryProvidesNewInformation(summary)) { // For failed test, write the failure to the scroll-back buffer immediately try { clearProgressBar(); + crlf(); setEventKindColor(EventKind.ERROR); - terminal.writeString("FAIL: "); + terminal.writeString("" + summary.getStatus() + ": "); terminal.resetTerminal(); terminal.writeString(summary.getTarget().getLabel().toString()); terminal.writeString(" (Summary)"); @@ -314,9 +338,6 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler { terminal.writeString(" " + logPath.getPathString()); crlf(); } - if (summary.getFailedLogs().size() > 0) { - crlf(); - } if (showProgress && cursorControl) { addProgressBar(); } |