[PATCH v8 00/18] perf test: Parallel harness optimizations, summary, JUnit XML & PMU fixes
From: Ian Rogers
Date: Tue Jun 02 2026 - 13:41:46 EST
This patch series dramatically improves the speed, usability, and test
reporting of the Linux perf test suite (`perf test`), and introduces PMU
matching optimizations. It optimizes the parallel execution harness,
introduces automated summary reporting, adds standardized JUnit XML report
generation, removes runtime external C compiler dependencies for continuous
integration environments, and avoids unnecessary PMU scanning.
1. Parallel execution optimizations:
- When running in parallel verbose mode (-v), the parent test harness
previously only polled the pipe of the current active test wait-loop,
blocking other children once they filled their 64KB pipe buffer.
This series refactors the loop to drain all children's output pipes
simultaneously, reducing parallel execution times for high-output
suites (like PMU events) from ~35 seconds down to ~5.9 seconds.
- Hardens `check_if_command_finished()` and `wait_or_whine()` inside
`tools/lib/subcmd` to safely handle invalid PIDs, using a robust
waitpid fallback when procfs limits are hit to prevent zombie leak
loops and PID reuse hazards.
- Fixes race conditions and concurrent process reaping hazards inside
the Intel TPEBS driver (`intel-tpebs.c`).
2. Improved Console Summary and Output Layout:
- Shows context failure snippets for failed tests in moderate verbose
mode (-v) without requiring extremely verbose output (-vv).
- Prints a concise, colored console execution summary showing passed,
skipped, and failed counts for main tests and individual subtests at
the absolute tail of the run, together with the indices of all
failed tests.
- Dynamically truncates long test descriptions to fit within the
terminal columns to prevent visual wrapping and duplicate printing
glitches, while ensuring suite headers are printed without trailing
padding that causes wrapping.
3. Automated JUnit XML Reports:
- Adds a `-j/--junit [filename]` option to generate standardized XML
test reports, capturing execution duration and XML-escaped failure
logs or skip reasons for each test.
- Includes a dedicated shell validation test validating XML report
structure via Python's ElementTree parser.
4. PMU Events & Monolithic Suite Splitting:
- Generates dynamic sub-tests for each PMU event metric table instead
of a single monolithic sanity test, enabling fine-grained tracing.
- Splits the monolithic `util` test suite into independent sub-tests
for easier failure isolation.
5. CI & Environmental Hardening:
- Removes runtime dependency on `/usr/bin/cc` inside the Intel PT
shell test by introducing a built-in `jitdump` C workload that
generates JIT self-modifying code natively across x86, ARM, RISC-V,
MIPS, and others.
6. PMU Core Matching Optimization:
- Treats "default_core" as a core PMU name in `is_pmu_core`, avoiding
slow and unnecessary scanning of other PMUs which always misses.
- Documents different types of core PMU matching approaches (x86 cpu,
s390 cpum_cf, ARM sysfs).
v8 Changes
----------
- Treat "default_core" as a core PMU to avoid slow and unnecessary scanning of
other PMUs.
- Dynamically truncate long test descriptions to fit within terminal columns
to prevent visual wrapping.
- Remove unnecessary padding from suite header prints to prevent colon wrapping
on newlines (resolves visual glitch in `perf test -v`).
Ian Rogers (18):
perf tpebs: Fix concurrent stop races and PID reuse hazards in
tpebs_stop
perf jevents.py: Make generated C code more kernel style
perf pmu-events: Add API to get metric table name and iterate tables
perf test: Drain pipe after child finishes to avoid losing output
perf test: Support dynamic test suites with setup callback and private
data
perf test pmu-events: A sub-test per metric table
tools subcmd: Robust fallback and existence checks for process reaping
perf test: Refactor parallel poll loop to drain all pipes
simultaneously
perf test: Show snippet failure output for verbose=1
perf test: Add summary reporting
perf test: Fix subtest status alignment for multi-digit indexes
perf test: Skip shebang and SPDX comments in shell test descriptions
perf test: Split monolithic 'util' test suite into sub-tests
perf test: Add -j/--junit option for JUnit XML test reports
perf test: Add shell test to validate JUnit XML reporting output
perf test: Remove /usr/bin/cc dependency from Intel PT shell test
perf pmu: Recognize 'default_core' as a core PMU and document matching
perf test: Truncate printed test descriptions dynamically to avoid
terminal wrapping
tools/lib/subcmd/run-command.c | 69 +-
tools/perf/pmu-events/empty-pmu-events.c | 8821 +++++++++++------
tools/perf/pmu-events/jevents.py | 847 +-
tools/perf/pmu-events/pmu-events.h | 5 +
tools/perf/tests/builtin-test.c | 788 +-
tools/perf/tests/pmu-events.c | 156 +-
tools/perf/tests/shell/test_intel_pt.sh | 169 +-
.../tests/shell/test_test_junit_output.sh | 63 +
tools/perf/tests/tests-scripts.c | 82 +-
tools/perf/tests/tests.h | 3 +
tools/perf/tests/util.c | 20 +-
tools/perf/tests/workloads/Build | 1 +
tools/perf/tests/workloads/jitdump.c | 210 +
tools/perf/util/intel-tpebs.c | 92 +-
tools/perf/util/jitdump.h | 3 +-
tools/perf/util/pmu.c | 19 +-
16 files changed, 7619 insertions(+), 3729 deletions(-)
create mode 100755 tools/perf/tests/shell/test_test_junit_output.sh
create mode 100644 tools/perf/tests/workloads/jitdump.c
--
2.54.0.1013.g208068f2d8-goog