perf test: Show snippet failure output for verbose=1
Currently, when running tests in verbose mode (-v), if a test case
fails, the entire raw standard error buffer is dumped to stderr via
fprintf(stderr, "%s", child->err_output.buf). For tests that generate
massive amounts of debugging or logging output before dying, this
results in multi-page terminal dumps where highly critical diagnostic
keywords (error, fail, segv) are easily lost.
Implement a smart, bounded snippet string processor to improve
failure triaging:
1. Introduce a configurable quota limit static unsigned int
failure_snippet_lines = 10; accessible via a new command-line option
--failure-snippet-lines <N>.
2. Parse the raw error buffer dynamically into lines and run a
three-pass extraction algorithm:
- Pass 0: Always select the very first line of the log as an initial
outline marker.
- Pass 1: Scan forward from the top of the log to pick up to N lines
that contain case-insensitive failure keywords (error, fail,
segv, abort) to isolate the root cause. Automatically pull in
the immediate subsequent line as highly-prioritized context.
Allow adjacent matching lines to overlap without dropping context
by evaluating keywords for all lines (e.g. when "Failed to
report" is followed by "Error:").
- Pass 2: If quota remains, scan backward from the absolute tail of
the log to capture trailing crash or abort context.
3. Output the selected lines in their original chronological order,
inserting a clear ... separator between non-contiguous line jumps.
4. Wrap matched failure keywords dynamically in bold red
(PERF_COLOR_RED) to immediately draw the eye to failures.
5. Invoke the smart processor purely when verbose == 1 && ret ==
TEST_FAIL in both finish_test and finish_tests_parallel, leaving
raw full-output dumping completely untouched when running highly
verbose (-vv).
Assisted-by: Gemini-CLI:Google Gemini 3 Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>