[PATCH v11 16/19] perf test: Skip the trace summary BPF tests without kernel BTF

From: Arnaldo Carvalho de Melo

Date: Sun Nov 22 2026 - 16:41:56 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

The --bpf-summary tests need BTF in the running kernel; perf check
feature bpf only tells whether perf was built with libbpf. Without
CONFIG_DEBUG_INFO_BTF the skeleton fails to load and the test fails
instead of skipping.

The /sys/kernel/btf/vmlinux file indicates that the running kernel has
BTF available for the tp_btf programs. Do not use an on-disk vmlinux
image for this check: it can be readable even when the running kernel
has no BTF loaded.

Fixes: 2d099ccaadf623d3 ("perf test: Add perf trace summary test")
Cc: Ian Rogers <irogers@xxxxxxxxxx>
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/tests/shell/trace_summary.sh | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/tools/perf/tests/shell/trace_summary.sh b/tools/perf/tests/shell/trace_summary.sh
index 0e603addb2a99d4d..154f85f16e6528f9 100755
--- a/tools/perf/tests/shell/trace_summary.sh
+++ b/tools/perf/tests/shell/trace_summary.sh
@@ -63,6 +63,15 @@ if ! perf check feature -q bpf; then
exit 2
fi

+# The tp_btf programs need BTF in the running kernel. A vmlinux image
+# on disk is not sufficient: it can be readable even when the kernel has
+# no BTF loaded.
+if [ ! -r /sys/kernel/btf/vmlinux ]; then
+ echo "Skip --bpf-summary tests as kernel BTF is missing"
+ rm -f ${OUTPUT}
+ exit 2
+fi
+
# summary only for system wide - per-thread summary with BPF
test_perf_trace "-as --summary-mode=thread --bpf-summary"

--
2.56.1