From: Ian Rogers <irogers@google.com>
To: Sri Jayaramappa <sjayaram@akamai.com>,
Guilherme Amadio <amadio@gentoo.org>,
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-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names
Date: Mon, 8 Dec 2025 09:23:39 -0800 [thread overview]
Message-ID: <20251208172339.1445817-1-irogers@google.com> (raw)
The test is based on an error/fix poseted to linux-perf-users.
Reported-by: Sri Jayaramappa <sjayaram@akamai.com>
Closes: https://lore.kernel.org/linux-perf-users/20251202213632.2873731-1-sjayaram@akamai.com/
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/subcmd-help.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tools/perf/tests/subcmd-help.c b/tools/perf/tests/subcmd-help.c
index 2280b4c0e5e7..9da96a16fd20 100644
--- a/tools/perf/tests/subcmd-help.c
+++ b/tools/perf/tests/subcmd-help.c
@@ -95,10 +95,36 @@ static int test__exclude_cmdnames(struct test_suite *test __maybe_unused,
return TEST_OK;
}
+static int test__exclude_cmdnames_no_overlap(struct test_suite *test __maybe_unused,
+ int subtest __maybe_unused)
+{
+ struct cmdnames cmds1 = {};
+ struct cmdnames cmds2 = {};
+
+ add_cmdname(&cmds1, "read-vdso32", 11);
+ add_cmdname(&cmds2, "archive", 7);
+
+ TEST_ASSERT_VAL("invalid original size", cmds1.cnt == 1);
+ TEST_ASSERT_VAL("invalid original size", cmds2.cnt == 1);
+
+ exclude_cmds(&cmds1, &cmds2);
+
+ TEST_ASSERT_VAL("invalid excluded size", cmds1.cnt == 1);
+ TEST_ASSERT_VAL("invalid excluded size", cmds2.cnt == 1);
+
+ TEST_ASSERT_VAL("cannot find cmd", is_in_cmdlist(&cmds1, "read-vdso32") == 1);
+ TEST_ASSERT_VAL("wrong cmd", is_in_cmdlist(&cmds1, "archive") == 0);
+
+ clean_cmdnames(&cmds1);
+ clean_cmdnames(&cmds2);
+ return TEST_OK;
+}
+
static struct test_case tests__subcmd_help[] = {
TEST_CASE("Load subcmd names", load_cmdnames),
TEST_CASE("Uniquify subcmd names", uniq_cmdnames),
TEST_CASE("Exclude duplicate subcmd names", exclude_cmdnames),
+ TEST_CASE("Exclude disjoint subcmd names", exclude_cmdnames_no_overlap),
{ .name = NULL, }
};
--
2.52.0.223.gf5cc29aaa4-goog
next reply other threads:[~2025-12-08 17:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 17:23 Ian Rogers [this message]
2025-12-11 1:12 ` [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names Jayaramappa, Srilakshmi
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=20251208172339.1445817-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=amadio@gentoo.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 \
--cc=sjayaram@akamai.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).