From: Ian Rogers <irogers@google.com>
To: Feng Yang <yangfeng@kylinos.cn>,
Yang Jihong <yangjihong1@huawei.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH v1] perf tests kwork: Add basic kwork coverage tests
Date: Tue, 9 Dec 2025 09:08:11 -0800 [thread overview]
Message-ID: <20251209170814.2009253-1-irogers@google.com> (raw)
Add basic kwork coverage tests for record, report, latency, timehist
and top.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/shell/kwork.sh | 79 +++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100755 tools/perf/tests/shell/kwork.sh
diff --git a/tools/perf/tests/shell/kwork.sh b/tools/perf/tests/shell/kwork.sh
new file mode 100755
index 000000000000..42bfd9382816
--- /dev/null
+++ b/tools/perf/tests/shell/kwork.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+# perf kwork tests
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+# Root permissions required for tracing events.
+if [ "$(id -u)" != 0 ]; then
+ echo "[Skip] No root permission"
+ exit 2
+fi
+
+err=0
+perfdata=$(mktemp /tmp/__perf_test_kwork.perf.data.XXXXX)
+
+cleanup() {
+ rm -f "${perfdata}"
+ rm -f "${perfdata}".old
+
+ trap - EXIT TERM INT
+}
+
+trap_cleanup() {
+ echo "Unexpected signal in ${FUNCNAME[1]}"
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+
+test_kwork_record() {
+ echo "Kwork record"
+ perf kwork record -o "${perfdata}" -- sleep 1
+ echo "Kwork record [Success]"
+}
+
+test_kwork_report() {
+ echo "Kwork report"
+ if ! perf kwork report -i "${perfdata}" | grep -q "Kwork Name"; then
+ echo "Kwork report [Failed missing output]"
+ err=1
+ fi
+ echo "Kwork report [Success]"
+}
+
+test_kwork_latency() {
+ echo "Kwork latency"
+ if ! perf kwork latency -i "${perfdata}" | grep -q "Avg delay"; then
+ echo "Kwork latency [Failed missing output]"
+ err=1
+ fi
+ echo "Kwork latency [Success]"
+}
+
+test_kwork_timehist() {
+ echo "Kwork timehist"
+ if ! perf kwork timehist -i "${perfdata}" | grep -q "Kwork name"; then
+ echo "Kwork timehist [Failed missing output]"
+ err=1
+ fi
+ echo "Kwork timehist [Success]"
+}
+
+test_kwork_top() {
+ echo "Kwork top"
+ if ! perf kwork top -i "${perfdata}" | grep -q "COMMAND"; then
+ echo "Kwork top [Failed missing output]"
+ err=1
+ fi
+ echo "Kwork top [Success]"
+}
+
+test_kwork_record
+test_kwork_report
+test_kwork_latency
+test_kwork_timehist
+test_kwork_top
+
+cleanup
+exit $err
--
2.52.0.223.gf5cc29aaa4-goog
reply other threads:[~2025-12-09 17:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251209170814.2009253-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--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 \
--cc=yangfeng@kylinos.cn \
--cc=yangjihong1@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).