public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names
@ 2025-12-08 17:23 Ian Rogers
  2025-12-11  1:12 ` Jayaramappa, Srilakshmi
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2025-12-08 17:23 UTC (permalink / raw)
  To: Sri Jayaramappa, Guilherme Amadio, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Alexander Shishkin,
	Jiri Olsa, Ian Rogers, Adrian Hunter, linux-perf-users,
	linux-kernel

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names
  2025-12-08 17:23 [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names Ian Rogers
@ 2025-12-11  1:12 ` Jayaramappa, Srilakshmi
  2026-01-08 19:27   ` Ian Rogers
  0 siblings, 1 reply; 4+ messages in thread
From: Jayaramappa, Srilakshmi @ 2025-12-11  1:12 UTC (permalink / raw)
  To: Ian Rogers, Guilherme Amadio, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Alexander Shishkin,
	Jiri Olsa, Adrian Hunter, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org


________________________________________
From: Ian Rogers <irogers@google.com>
Sent: Monday, December 8, 2025 9:23 AM
To: Jayaramappa, Srilakshmi; Guilherme Amadio; Peter Zijlstra; Ingo Molnar; Arnaldo Carvalho de Melo; Namhyung Kim; Alexander Shishkin; Jiri Olsa; Ian Rogers; Adrian Hunter; linux-perf-users@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names

!-------------------------------------------------------------------|
  This Message Is From an External Sender
  This message came from outside your organization.
|-------------------------------------------------------------------!

The test is based on an error/fix poseted to linux-perf-users.

Reported-by: Sri Jayaramappa <sjayaram@akamai.com>
Closes: https://urldefense.com/v3/__https://lore.kernel.org/linux-perf-users/20251202213632.2873731-1-sjayaram@akamai.com/__;!!GjvTz_vk!XehekKNUE4Ib_tvqIH6PMIIhly4X3BZ-Y40RC1HKMQ-6OdYEFvUPQhyWv_gk9vsRRN4_RcOLS2Bh0CQ$
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


Reviewed-by: Sri Jayaramappa <sjayaram@akamai.com>

Looks good, thank you !

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names
  2025-12-11  1:12 ` Jayaramappa, Srilakshmi
@ 2026-01-08 19:27   ` Ian Rogers
  2026-01-13 14:41     ` Guilherme Amadio
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2026-01-08 19:27 UTC (permalink / raw)
  To: Jayaramappa, Srilakshmi
  Cc: Guilherme Amadio, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Alexander Shishkin,
	Jiri Olsa, Adrian Hunter, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Wed, Dec 10, 2025 at 5:12 PM Jayaramappa, Srilakshmi
<sjayaram@akamai.com> wrote:
>
>
> ________________________________________
> From: Ian Rogers <irogers@google.com>
> Sent: Monday, December 8, 2025 9:23 AM
> To: Jayaramappa, Srilakshmi; Guilherme Amadio; Peter Zijlstra; Ingo Molnar; Arnaldo Carvalho de Melo; Namhyung Kim; Alexander Shishkin; Jiri Olsa; Ian Rogers; Adrian Hunter; linux-perf-users@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names
>
> !-------------------------------------------------------------------|
>   This Message Is From an External Sender
>   This message came from outside your organization.
> |-------------------------------------------------------------------!
>
> The test is based on an error/fix poseted to linux-perf-users.
>
> Reported-by: Sri Jayaramappa <sjayaram@akamai.com>
> Closes: https://urldefense.com/v3/__https://lore.kernel.org/linux-perf-users/20251202213632.2873731-1-sjayaram@akamai.com/__;!!GjvTz_vk!XehekKNUE4Ib_tvqIH6PMIIhly4X3BZ-Y40RC1HKMQ-6OdYEFvUPQhyWv_gk9vsRRN4_RcOLS2Bh0CQ$
> 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
>
>
> Reviewed-by: Sri Jayaramappa <sjayaram@akamai.com>

Ping.

Thanks,
Ian

> Looks good, thank you !

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names
  2026-01-08 19:27   ` Ian Rogers
@ 2026-01-13 14:41     ` Guilherme Amadio
  0 siblings, 0 replies; 4+ messages in thread
From: Guilherme Amadio @ 2026-01-13 14:41 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Jayaramappa, Srilakshmi, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Alexander Shishkin,
	Jiri Olsa, Adrian Hunter, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org

Dear Ian,

On Thu, Jan 08, 2026 at 11:27:51AM -0800, Ian Rogers wrote:
> On Wed, Dec 10, 2025 at 5:12 PM Jayaramappa, Srilakshmi
> <sjayaram@akamai.com> wrote:
> >
> >
> > ________________________________________
> > From: Ian Rogers <irogers@google.com>
> > Sent: Monday, December 8, 2025 9:23 AM
> > To: Jayaramappa, Srilakshmi; Guilherme Amadio; Peter Zijlstra; Ingo Molnar; Arnaldo Carvalho de Melo; Namhyung Kim; Alexander Shishkin; Jiri Olsa; Ian Rogers; Adrian Hunter; linux-perf-users@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names
> >
> > !-------------------------------------------------------------------|
> >   This Message Is From an External Sender
> >   This message came from outside your organization.
> > |-------------------------------------------------------------------!
> >
> > The test is based on an error/fix poseted to linux-perf-users.
> >
> > Reported-by: Sri Jayaramappa <sjayaram@akamai.com>
> > Closes: https://urldefense.com/v3/__https://lore.kernel.org/linux-perf-users/20251202213632.2873731-1-sjayaram@akamai.com/__;!!GjvTz_vk!XehekKNUE4Ib_tvqIH6PMIIhly4X3BZ-Y40RC1HKMQ-6OdYEFvUPQhyWv_gk9vsRRN4_RcOLS2Bh0CQ$
> > 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
> >
> >
> > Reviewed-by: Sri Jayaramappa <sjayaram@akamai.com>
> 
> Ping.

Assuming this is for me, I just tried the test and it correctly
fails for me on perf-tools-next (I applied the diff by hand, as it
didn't apply cleanly onto the commit below):

gentoo linux $ git log -1 --format=short
commit 75326c67aa8c43000819a2ac29f22eb27846d545 (HEAD -> perf-tools-next, perf-tools-next/tmp.perf-tools-next, perf-tools-next/perf-tools-next)
Author: Derek Foreman <derek.foreman@collabora.com>

    perf data: Fix coding style
gentoo linux $ tools/perf/perf version
perf version 6.19.rc4.g75326c67aa8c
gentoo linux $ git diff --stat
 tools/perf/tests/subcmd-help.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
gentoo linux $ sudo ./tools/perf/perf test -vF disjoint
--- start ---
perf: help.c:107: exclude_cmds: Assertion `cmds->names[ci] == NULL' failed.
Aborted                    (core dumped) tools/perf/perf test -vF disjoint

Then I applied the patch by Sri Jayaramappa with the fix, and the test now works:

gentoo linux $ sudo tools/perf/perf test -vF disjoint
--- start ---
---- end ----
 68.4: Exclude disjoint subcmd names                                 : Ok

So you can add a Reviewed-by: Guilherme Amadio <amadio@gentoo.org>
and/or Tested-by: Guilherme Amadio <amadio@gentoo.org> for both this and
the patch at the link below:

https://lore.kernel.org/lkml/20251202213632.2873731-1-sjayaram@akamai.com/

Cheers,
-Guilherme

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-13 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08 17:23 [PATCH v1] perf test subcmd help: Add exclude disjoint subcmd names Ian Rogers
2025-12-11  1:12 ` Jayaramappa, Srilakshmi
2026-01-08 19:27   ` Ian Rogers
2026-01-13 14:41     ` Guilherme Amadio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox