[PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found
From: Arnaldo Carvalho de Melo
Date: Fri Nov 20 2026 - 22:21:12 EST
From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Hi,
Nothing measured how much of perf the test suite reaches. Patches 15-16
add coverage.sh, which builds perf with clang source based coverage, runs
the full test suite and reports line and function coverage, and
coverage-table.sh, which renders the biggest uncovered gaps over the
whole tree, not only the files the tests already touch.
Patches 1-6 are the fixes the first runs found, 7-14 their tests and the
test fixes. 1 is a build fix for the GTK UI, which the coverage build
needs; 5 is a parser change, not a regression fix.
- The GTK UI was not linked with EXTRA_CFLAGS, so the coverage build
never saw its counters (1).
- Absolute addressing was missing from the data type resolver (2);
movabs was not parsed (5).
- --insn-stat was printed before the samples were accounted (3).
- FEATURE-DUMP didn't record features checked outside FEATURE_TESTS
(4).
- The flexible array member row showed 0.00% while the member said
100.00% (6).
- Tests for the x86 operand parser (7), DW_OP_addrx globals (8, test
only: fixed upstream by c3991e42f58a3650), the flexible array path
(9), a struct pointer kept in a register at -O2 (10) and the
annotate stats (11).
- Intel PT virtual LBR, dlfilter zeroed IP and LBR inline unwinding
test fixes (12-14).
clang DWARF 4, full test suite as root on this AMD host with the v10
plus cs-etm tree: 112250 of 232853 lines (48.21%), 86661 of 173942 in
tools/perf/ (49.82%), 170 passed, one failure (21.2, the known
Tracepoint event kernel regression). The total includes libbpf and the
dlfilters, so it is not comparable with the v6 total.
The harness and the tests were developed with an AI coding assistant
(OpenCode), which drafted the script and the tests and helped debug the
failures; I reviewed every change and reproduced each failure.
What changed from v9:
- Split into fixes, tests and infrastructure; the fixes no longer
carry their tests.
- The harness is 15 and the table is split out of it as 16.
- The libbfd probe (v9 9) is dropped, the base checks it via
Makefile.feature (5aa34144027f); the movabs change (5) is new.
- 8 and 10: diagnostic greps use || true, so they no longer fire the
EXIT trap.
Best regards,
- Arnaldo
Arnaldo Carvalho de Melo (16):
perf build: Link the GTK UI with EXTRA_CFLAGS
perf annotate: Handle absolute addressing in data type profiling
perf annotate: Print the stats after the annotations
perf build: Record the features checked outside FEATURE_TESTS
perf annotate-x86: Parse movabs like a mov
perf annotate-data: Count flexible array accesses for the whole struct
perf tests: Exercise the x86 operand parser
perf tests: Exercise DW_OP_addrx global variables
perf tests: Exercise the flexible array member path
perf tests: Exercise data type resolution from a register
perf tests: Exercise the annotate stats output
perf tests: Fix the Intel PT virtual LBR check
perf test: Drop samples without an IP in the dlfilter test
perf test: Skip the LBR inline unwinding check when unsupported
perf scripts: Add a coverage harness for perf
perf scripts: Add a coverage table
tools/perf/.gitignore | 1 +
tools/perf/Documentation/perf-annotate.txt | 2 +-
tools/perf/Makefile | 15 +-
tools/perf/Makefile.config | 7 +
tools/perf/Makefile.perf | 8 +-
tools/perf/builtin-annotate.c | 19 +-
tools/perf/scripts/coverage-table.sh | 310 +++++++++++++
tools/perf/scripts/coverage.sh | 434 ++++++++++++++++++
tools/perf/tests/Build | 1 +
tools/perf/tests/annotate-ops.c | 127 +++++
tools/perf/tests/builtin-test.c | 4 +
tools/perf/tests/shell/addr2line_inlines.sh | 20 +-
tools/perf/tests/shell/annotate_stats.sh | 69 +++
.../perf/tests/shell/data_type_flex_array.sh | 111 +++++
tools/perf/tests/shell/data_type_global.sh | 73 +++
tools/perf/tests/shell/data_type_register.sh | 63 +++
tools/perf/tests/shell/script_dlfilter.sh | 2 +-
tools/perf/tests/shell/test_intel_pt.sh | 10 +-
tools/perf/tests/tests.h | 4 +
tools/perf/tests/workloads/Build | 6 +
tools/perf/tests/workloads/flex_array.c | 55 +++
tools/perf/tests/workloads/global_data.c | 57 +++
tools/perf/tests/workloads/regptr.c | 60 +++
tools/perf/ui/browsers/annotate-data.c | 7 +-
tools/perf/util/annotate-arch/annotate-x86.c | 45 +-
tools/perf/util/annotate-data.c | 25 +-
tools/perf/util/annotate-data.h | 8 +
tools/perf/util/annotate.c | 27 +-
tools/perf/util/annotate.h | 7 +
29 files changed, 1548 insertions(+), 29 deletions(-)
create mode 100755 tools/perf/scripts/coverage-table.sh
create mode 100755 tools/perf/scripts/coverage.sh
create mode 100644 tools/perf/tests/annotate-ops.c
create mode 100755 tools/perf/tests/shell/annotate_stats.sh
create mode 100755 tools/perf/tests/shell/data_type_flex_array.sh
create mode 100755 tools/perf/tests/shell/data_type_global.sh
create mode 100755 tools/perf/tests/shell/data_type_register.sh
create mode 100644 tools/perf/tests/workloads/flex_array.c
create mode 100644 tools/perf/tests/workloads/global_data.c
create mode 100644 tools/perf/tests/workloads/regptr.c
base-commit: bb27ddbaee56536fb8df0a24f07b526766dfe131
v1-head: 3f5465bea8f5a97a
v2-head: 9706c488afffeb6d
v3-head: f2daf1586528671a
v4-head: b9e240a1b80ecd2a
v5-head: a21454e3d055c93b
v6-head: e1315408a335617d
v7-head: 7f8dc594d77ed495
v8-head: 67fde34aeab98a91
v9-head: b1765115908ede31
v10-head: 83b30d979fb2d96d
--
2.56.0