[PATCH v5 0/2] perf tests: Add uncore and x86 topdown event sorting tests
From: Ian Rogers
Date: Sun May 17 2026 - 20:37:31 EST
A patch thread changing event sorting highlighted a lack of testing
for the more complicated uncore and x86 perf metric event sorting:
https://lore.kernel.org/linux-perf-users/CAP-5=fWRgDo7UnJAD4C--d=mVPRhOEWZVyU7nVM1YEp3jncAgg@xxxxxxxxxxxxxx/
v5: - Strengthen uncore event sorting test assertions to require at
least 4 total events (>= 2 groups of 2 events) instead of > 0
events, guaranteeing that multi-PMU wildcard expansion is
genuinely exercised across multiple sibling PMUs (reported by Sashiko).
- Fix memory leaks on assertion failure across both uncore and
topdown test suites by replacing standard TEST_ASSERT macros
with local CHECK macros that correctly branch to out_err cleanup
handlers (reported by Sashiko).
- Fix test_sort() in the x86 topdown test to correctly return TEST_FAIL (-1)
instead of parse_events() internal error codes (e.g., -EINVAL) when event
parsing fails (reported by Namhyung).
v4: Fix malformed event group string formatting in the uncore event
sorting test when running on AMD systems (where sysfs event
aliases lack JSON descriptions - reported by Namhyung). Added a
helper to strip redundant PMU prefixes and trailing slashes to
ensure parse_events() receives valid syntax across all
architectures.
v3: Address sashiko nits on using evsel__name and ensuring slots is injected.
https://lore.kernel.org/linux-perf-users/20260331185419.4085479-1-irogers@xxxxxxxxxx/
v2: Address indentation and other nits from Namhyung. Add Zide Chen's
tested-by tags.
https://lore.kernel.org/lkml/20260331165207.4016392-1-irogers@xxxxxxxxxx/
v1: https://lore.kernel.org/lkml/20260325183045.1229502-1-irogers@xxxxxxxxxx/
Ian Rogers (2):
perf tests: Add test for uncore event sorting
perf arch x86 tests: Add test for topdown event sorting
tools/perf/arch/x86/tests/topdown.c | 148 +++++++++++++++++++-
tools/perf/tests/Build | 1 +
tools/perf/tests/builtin-test.c | 1 +
tools/perf/tests/tests.h | 1 +
tools/perf/tests/uncore-event-sorting.c | 174 ++++++++++++++++++++++++
5 files changed, 324 insertions(+), 1 deletion(-)
create mode 100644 tools/perf/tests/uncore-event-sorting.c
--
2.54.0.563.g4f69b47b94-goog