[PATCH v4 15/18] perf test trace_summary: Improve error diagnostics
From: Ian Rogers
Date: Fri Sep 18 2026 - 17:26:16 EST
When pattern matching fails in test_perf_trace(), print the command
that failed along with the actual match count, the matching lines
found, and the last 20 lines of output to aid debugging.
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/tests/shell/trace_summary.sh | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/shell/trace_summary.sh b/tools/perf/tests/shell/trace_summary.sh
index b80dea77cec6..4589b4581419 100755
--- a/tools/perf/tests/shell/trace_summary.sh
+++ b/tools/perf/tests/shell/trace_summary.sh
@@ -28,10 +28,16 @@ test_perf_trace() {
count=$(grep -E -c -m 3 "${search}" ${OUTPUT})
if [ "${count}" != "3" ]; then
- echo "Error: cannot find enough pattern ${search} in the output"
- cat ${OUTPUT}
- rm -f ${OUTPUT}
- exit 1
+ echo "Error: cannot find enough pattern ${search} (count=${count}) in output of:"
+ echo "Error: perf trace ${args} -- ${workload}"
+ echo "Error: matched lines:"
+ grep -E "${search}" ${OUTPUT} || echo "none"
+ echo "Error: last 20 lines of output:"
+ # The summary is printed after any trace output, so show the end of
+ # the file: with -S the head of it is the trace, not what is matched.
+ tail -n 20 ${OUTPUT}
+ rm -f ${OUTPUT}
+ exit 1
fi
}
--
2.55.0.1082.g2b9226bbc0-goog