From: Ian Rogers <irogers@google.com>
To: irogers@google.com, acme@kernel.org, namhyung@kernel.org
Cc: adrian.hunter@intel.com, eranian@google.com,
james.clark@linaro.org, jolsa@kernel.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
mingo@redhat.com, peterz@infradead.org
Subject: [RFC PATCH v2 9/9] perf test: Add perf sysinfo shell test
Date: Sat, 17 Oct 2026 11:54:42 -0700 [thread overview]
Message-ID: <20261017185442.2137623-10-irogers@google.com> (raw)
In-Reply-To: <20261017185442.2137623-1-irogers@google.com>
Add a shell test exercising default 'perf sysinfo' summary output,
'--pmus' per-PMU output, '-j' JSON validation, PMU glob filtering, and
'-i perf.data' inspection.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/shell/sysinfo.sh | 71 +++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100755 tools/perf/tests/shell/sysinfo.sh
diff --git a/tools/perf/tests/shell/sysinfo.sh b/tools/perf/tests/shell/sysinfo.sh
new file mode 100755
index 000000000000..40e90af6dca2
--- /dev/null
+++ b/tools/perf/tests/shell/sysinfo.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# perf sysinfo tests
+
+set -e
+
+shelldir=$(dirname "$0")
+. "${shelldir}"/lib/setup_python.sh
+
+sysinfo_output=$(mktemp /tmp/__perf_test.sysinfo_output.XXXXX)
+perf_data=$(mktemp /tmp/__perf_test.sysinfo.perf.data.XXXXX)
+
+cleanup() {
+ rm -f "${sysinfo_output}" "${perf_data}" "${perf_data}.old"
+ trap - EXIT TERM INT
+}
+
+trap_cleanup() {
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+
+test_sysinfo_default() {
+ echo "Default perf sysinfo output test"
+ perf sysinfo -o "${sysinfo_output}"
+ grep -q "^Summary:" "${sysinfo_output}"
+ grep -q "System rating:" "${sysinfo_output}"
+ perf sysinfo --pmus -o "${sysinfo_output}"
+ grep -q "^software (" "${sysinfo_output}"
+ grep -q "^Summary:" "${sysinfo_output}"
+ echo "Default perf sysinfo output test [Success]"
+}
+
+test_sysinfo_json() {
+ echo "Json perf sysinfo output test"
+ perf sysinfo -j -o "${sysinfo_output}"
+ $PYTHON -m json.tool "${sysinfo_output}" /dev/null
+ echo "Json perf sysinfo output test [Success]"
+}
+
+test_sysinfo_filter() {
+ echo "Filtered perf sysinfo output test"
+ perf sysinfo -o "${sysinfo_output}" software
+ grep -q "^software (" "${sysinfo_output}"
+ grep -q "Sample types:.*ip" "${sysinfo_output}"
+ grep -q "User registers:" "${sysinfo_output}"
+ grep -q "Intr registers:" "${sysinfo_output}"
+ grep -q "Features:.*leader_sampling" "${sysinfo_output}"
+ grep -q "Features:.*sw_grouping" "${sysinfo_output}"
+ echo "Filtered perf sysinfo output test [Success]"
+}
+
+test_sysinfo_perf_data() {
+ echo "perf.data perf sysinfo test"
+ perf record -e software/cpu-clock/u -o "${perf_data}" -- true 2>/dev/null
+ perf sysinfo -i "${perf_data}" -o "${sysinfo_output}"
+ grep -q "^Summary:" "${sysinfo_output}"
+ perf sysinfo --pmus -i "${perf_data}" -o "${sysinfo_output}"
+ grep -q "software" "${sysinfo_output}"
+ perf sysinfo -i "${perf_data}" -j -o "${sysinfo_output}"
+ $PYTHON -m json.tool "${sysinfo_output}" /dev/null
+ echo "perf.data perf sysinfo test [Success]"
+}
+
+test_sysinfo_default
+test_sysinfo_json
+test_sysinfo_filter
+test_sysinfo_perf_data
+cleanup
+exit 0
--
2.56.0.212.g129ede20d9-goog
next prev parent reply other threads:[~2026-10-17 18:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 21:32 [RFC PATCH v1 0/2] perf sysinfo: Add subcommand to probe and summarize PMU capabilities Ian Rogers
2026-10-16 21:32 ` [RFC PATCH v1 1/2] perf pmus: Add PMU environment loading and live capability probing Ian Rogers
2026-10-16 21:56 ` sashiko-bot
2026-10-16 21:32 ` [RFC PATCH v1 2/2] perf sysinfo: Add sysinfo subcommand, documentation, and test Ian Rogers
2026-10-16 21:45 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 0/9] perf sysinfo: Add subcommand to probe and summarize PMU capabilities Ian Rogers
2026-10-17 18:54 ` [RFC PATCH v2 1/9] perf pmu: Add from_env parameter to perf_pmu__init() Ian Rogers
2026-10-17 19:06 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 2/9] perf pmus: Add perf_pmus__read_from_env() Ian Rogers
2026-10-17 19:15 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 3/9] perf pmus: Expose duplicate uncore PMU scanning helpers Ian Rogers
2026-10-17 18:58 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 4/9] perf mem-events: Expose PMU init and name formatting helpers Ian Rogers
2026-10-17 18:58 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 5/9] perf pmu: Add perf_pmu__probe() for live capability probing Ian Rogers
2026-10-17 19:18 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 6/9] perf pmu: Probe registers, memory events, rdpmc, and branch skid Ian Rogers
2026-10-17 19:15 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 7/9] perf sysinfo: Add sysinfo subcommand Ian Rogers
2026-10-17 19:14 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 8/9] perf docs: Add perf-sysinfo man page Ian Rogers
2026-10-17 18:57 ` sashiko-bot
2026-10-17 18:54 ` Ian Rogers [this message]
2026-10-17 18:58 ` [RFC PATCH v2 9/9] perf test: Add perf sysinfo shell test sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261017185442.2137623-10-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=eranian@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.