aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-06-20 15:32:10 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-06-21 09:58:00 +0000
commitf7ee9885f844b17da1e83c81e6479b5bbb9857e5 (patch)
treef25ec5aeb8c942a2c84e14ecbe9bdcdb3ed151b3
parent480ac15266224feaf5f1aa3a0a36e5f3e4602881 (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
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java31
-rwxr-xr-xsrc/test/shell/integration/experimental_ui_test.sh5
2 files changed, 28 insertions, 8 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();
}
diff --git a/src/test/shell/integration/experimental_ui_test.sh b/src/test/shell/integration/experimental_ui_test.sh
index 2ec869f8a9..9f4a855fd4 100755
--- a/src/test/shell/integration/experimental_ui_test.sh
+++ b/src/test/shell/integration/experimental_ui_test.sh
@@ -215,9 +215,8 @@ function test_failure_scrollback_buffer_curses {
bazel test --experimental_ui --curses=yes --color=yes \
--nocache_test_results pkg:false pkg:slow 2>$TEST_log \
&& fail "expected failure"
- # Some line starting with FAIL in red bold replaces a previous one
- # (the old progress bar that is deleted
- expect_log $'\x1b\[K\x1b\[31m\x1b\[1mFAIL:'
+ # Some line starts with FAIL in red bold.
+ expect_log '^'$'\x1b\[31m\x1b\[1mFAIL:'
}
function test_failure_scrollback_buffer {