[PATCH v1 00/17] perf tests: Add coverage for the untested perf subcommands
From: Arnaldo Carvalho de Melo
Date: Tue Nov 24 2026 - 13:46:16 EST
Hi,
The v12 "perf coverage: A harness for perf, and the fixes it found"
series is still unmerged. The coverage analysis done for it showed
that several perf subcommands had no shell test coverage at all, and it
also caught two issues in the existing tests. This series is that
result, made independent of the harness: everything here applies to
perf-tools-next with nothing from v12, so it can be considered on its
own while that series is still being reviewed.
Patches 1-2 fix existing tests, patches 3-17 add or extend tests for
the subcommands the analysis found untested. All changes are in
tools/perf/tests/shell/, no production code is touched.
- perf top pins its ring buffer to the default data size, so the
result does not depend on the host's perf_event_mlock_kb (1).
- perf sched captures the workload output before grepping it, so a
saturating grep cannot kill the producer with SIGPIPE;
--no-inherit was dropped, it is already cleared for CPU-wide
recording (2).
- help (3) and config (4) get their first tests; help -a works in
build trees via a dummy exec path.
- script list, fields and dump (5), report and diff sort keys (6).
- diff options (7) are checked by what each changes: the compute
formulas by their column, --time by a window that shows nothing,
-o by the entry order, -b on a file whose entries have no baseline
match.
- annotate (8) and report (9) options the same way; the ones with
nothing to observe in stdio output run as parse checks.
- record (10), trace (11) and timechart (12) options.
- kmem (13) and bench (14) get their first tests; the bench ones
skip cleanly when root or the hardware is missing, including
benchmarks that skip themselves with a zero exit status.
- lock (15) report and info, probe (16) variable and line listing.
- report TUI (17): the six browsers are driven from a pty.
Running as non-root on this host, 13 of the 17 scripts exit 0; perf
sched, kmem, lock and trace need root and exit 2 with their skip
message, as designed. All option names and expectations were checked
against the built perf -h output and the sources.
The tests, the two fixes and the review fixes were developed with an AI
coding assistant (OpenCode): it drafted the tests, found the two issues
above and processed three rounds of review findings. Every commit was
reviewed, amended and run here before posting.
Arnaldo Carvalho de Melo (17):
perf tests top: Pin the ring buffer size
perf tests sched: Exercise the sched views and options
perf tests help: Add a basic perf help test
perf tests config: Exercise the config file and list options
perf tests script: Exercise the list, fields and dump options
perf tests sort: Exercise the report and diff sort keys
perf tests diff: Exercise the output options
perf tests annotate: Exercise the output and filter options
perf tests report: Exercise the output and format options
perf tests record: Exercise more record options
perf tests trace: Exercise the tracing options
perf tests timechart: Exercise the report options
perf tests kmem: Add a basic perf kmem test
perf tests bench: Add smoke tests for perf bench
perf tests lock: Exercise perf lock report and info
perf tests probe: Exercise the variable and line listing
perf tests report: Exercise the TUI browsers
tools/perf/tests/shell/annotate.sh | 64 +++++++
tools/perf/tests/shell/bench.sh | 130 +++++++++++++
tools/perf/tests/shell/config.sh | 134 ++++++++++++++
tools/perf/tests/shell/diff.sh | 191 ++++++++++++++++++-
tools/perf/tests/shell/help.sh | 80 ++++++++
tools/perf/tests/shell/kmem.sh | 215 ++++++++++++++++++++++
tools/perf/tests/shell/lock_contention.sh | 40 ++++
tools/perf/tests/shell/probe_vars.sh | 80 ++++++++
tools/perf/tests/shell/record_options.sh | 173 +++++++++++++++++
tools/perf/tests/shell/report_options.sh | 122 ++++++++++++
tools/perf/tests/shell/report_tui.sh | 112 +++++++++++
tools/perf/tests/shell/sched.sh | 154 +++++++++++-----
tools/perf/tests/shell/script.sh | 131 ++++++++++++-
tools/perf/tests/shell/sort.sh | 72 ++++++++
tools/perf/tests/shell/timechart.sh | 46 +++++
tools/perf/tests/shell/top.sh | 7 +-
tools/perf/tests/shell/trace_options.sh | 97 ++++++++++
17 files changed, 1794 insertions(+), 54 deletions(-)
create mode 100755 tools/perf/tests/shell/bench.sh
create mode 100755 tools/perf/tests/shell/config.sh
create mode 100755 tools/perf/tests/shell/help.sh
create mode 100755 tools/perf/tests/shell/kmem.sh
create mode 100755 tools/perf/tests/shell/probe_vars.sh
create mode 100755 tools/perf/tests/shell/record_options.sh
create mode 100755 tools/perf/tests/shell/report_options.sh
create mode 100755 tools/perf/tests/shell/report_tui.sh
create mode 100755 tools/perf/tests/shell/sort.sh
create mode 100755 tools/perf/tests/shell/trace_options.sh
--
2.56.0