bazelbuild / bazelbuild/bazel

Support showing the last N lines of `stdouterr` or test logs when over the byte limit

Open
#14,767 14 comments 2 reactions 0 assignees View on GitHub
P3 team-Core type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the problem / feature request:

Especially when Bazel is used for continuous integration, often on systems the developer doesn't have access to use interactively, it can be essential to provide error messages when a test fails.

However, it is also useful to have limits on how much data is shown. Even a CI system could be overwhelmed.

Bazel has two ways of limiting the output: `--max_test_output_bytes` and `--experimental_ui_max_stdouterr_bytes`. (Note that #14766 is filed to clarify the role of these two flags at least in the docs).

Either way, when a test (or stdouterr) is over the byte limit, it would be really nice to have an option to still display the last N lines (with `N` configurable via a flag, and defaulting to something moderately reasonable like 100) if that would be under the byte limit, or the list M bytes if all else fails.

The flags might look like: `--max_test_output_bytes_exceeded_tail_lines=N` and `--max_test_output_bytes_exceeded_tail_bytes=M`

### Feature requests: what underlying problem are you trying to solve with this feature?

Bazel test failures on CI that happen to generate large output are essentially un-debuggable if you can't reproduce locally.

Contributor guide

Open the contributing guide

Research direction

Start by reading Bazel's existing handling of --max_test_output_bytes and --experimental_ui_max_stdouterr_bytes. Define how configurable tail lines and tail bytes interact when output exceeds a limit, then verify that CI test failures show the requested tail without exceeding the byte limit.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.