From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
James Clark <james.clark@linaro.org>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Clark Williams <williams@redhat.com>,
linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Athira Rajeev <atrajeev@linux.ibm.com>
Subject: [PATCH v3 04/18] perf tests help: Add a basic perf help test
Date: Wed, 2 Dec 2026 09:14:20 -0300 [thread overview]
Message-ID: <20261202121434.2224-5-acme@kernel.org> (raw)
In-Reply-To: <20261202121434.2224-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
perf help and its -a option were not exercised by the suite. Check the
common command list and the command directory listing.
Reviewed-by: Athira Rajeev <atrajeev@linux.ibm.com>
Tested-by: Athira Rajeev <atrajeev@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/help.sh | 80 ++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
create mode 100755 tools/perf/tests/shell/help.sh
diff --git a/tools/perf/tests/shell/help.sh b/tools/perf/tests/shell/help.sh
new file mode 100755
index 0000000000000000..b7279a97a5615193
--- /dev/null
+++ b/tools/perf/tests/shell/help.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+# perf help tests
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+err=0
+out=$(mktemp /tmp/__perf_test_help.out.XXXXX)
+exec_path=
+
+cleanup() {
+ rm -f "${out}"
+ [ -z "${exec_path}" ] || rm -rf "${exec_path}"
+
+ trap - EXIT TERM INT
+}
+
+trap_cleanup() {
+ echo "Unexpected signal in ${FUNCNAME[1]}"
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+
+test_help_commands() {
+ echo "perf help commands test"
+ if ! perf help > "${out}" 2>&1; then
+ echo "perf help commands test [Failed: perf help failed]"
+ cat "${out}"
+ err=1
+ return
+ fi
+ if ! grep -q "The most commonly used perf commands are" "${out}"; then
+ echo "perf help commands test [Failed missing command list]"
+ cat "${out}"
+ err=1
+ return
+ fi
+ if ! grep -q "See 'perf help COMMAND'" "${out}"; then
+ echo "perf help commands test [Failed missing help hint]"
+ err=1
+ return
+ fi
+ echo "perf help commands test [Success]"
+}
+
+test_help_all() {
+ echo "perf help -a test"
+ # "available perf commands in" is printed only when the exec path holds
+ # perf-* commands, which a build tree does not have. Give help -a a
+ # temporary exec path with a dummy command to look for.
+ exec_path=$(mktemp -d /tmp/__perf_test_help_exec.XXXXXX)
+ printf '#!/bin/sh\n' > "${exec_path}/perf-dummy"
+ chmod +x "${exec_path}/perf-dummy"
+ if ! PERF_EXEC_PATH="${exec_path}" perf help -a > "${out}" 2>&1; then
+ echo "perf help -a test [Failed: perf help -a failed]"
+ cat "${out}"
+ err=1
+ return
+ fi
+ if ! grep -q "available perf commands in" "${out}"; then
+ echo "perf help -a test [Failed missing command directory]"
+ cat "${out}"
+ err=1
+ return
+ fi
+ if ! grep -q " dummy" "${out}"; then
+ echo "perf help -a test [Failed missing command from exec path]"
+ cat "${out}"
+ err=1
+ return
+ fi
+ echo "perf help -a test [Success]"
+}
+
+test_help_commands
+test_help_all
+
+cleanup
+exit $err
--
2.56.0
next prev parent reply other threads:[~2026-12-02 12:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 12:14 [PATCH v3 00/18] perf tests: Add coverage for the untested perf subcommands Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 01/18] perf kmem: Use the allocation order when matching page frees Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 02/18] perf tests top: Pin the ring buffer size Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 03/18] perf tests sched: Exercise the sched views and options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` Arnaldo Carvalho de Melo [this message]
2026-12-02 12:14 ` [PATCH v3 05/18] perf tests config: Exercise the config file and list options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 06/18] perf tests script: Exercise the list, fields and dump options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 07/18] perf tests sort: Exercise the report and diff sort keys Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 08/18] perf tests diff: Exercise the output options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 09/18] perf tests annotate: Exercise the output and filter options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 10/18] perf tests report: Exercise the output and format options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 11/18] perf tests record: Exercise more record options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 12/18] perf tests trace: Exercise the tracing options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 13/18] perf tests timechart: Exercise the report options Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 14/18] perf tests kmem: Add a basic perf kmem test Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 15/18] perf tests bench: Add smoke tests for perf bench Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 16/18] perf tests lock: Exercise perf lock report and info Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 17/18] perf tests probe: Exercise the variable and line listing Arnaldo Carvalho de Melo
2026-12-02 12:14 ` [PATCH v3 18/18] perf tests report: Exercise the TUI browsers Arnaldo Carvalho de Melo
2026-12-02 12:30 ` [PATCH v3 00/18] perf tests: Add coverage for the untested perf subcommands 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=20261202121434.2224-5-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=atrajeev@linux.ibm.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.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 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.