All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/3] perf test: Check test suite description only
Date: Tue, 1 Jul 2025 12:49:27 -0700	[thread overview]
Message-ID: <aGQ7xzAQpRUghD35@google.com> (raw)
In-Reply-To: <CAP-5=fXFESx7_+CY-QMnaZSkPSxTGFqwr1eKhHmTbEJoYeMTvQ@mail.gmail.com>

On Tue, Jul 01, 2025 at 08:51:53AM -0700, Ian Rogers wrote:
> On Mon, Jun 30, 2025 at 4:32 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > Currently perf test checks the given string with descriptions for both
> > test suites and cases (subtests).  But sometimes it's confusing since
> > the subtests don't contain the important keyword.
> >
> > I think it's better to check the suite level and run the whole suite
> > together.
> >
> > Before:
> >   $ perf test hwmon
> >   (no output)
> >
> > After:
> >   $ perf test hwmon
> >    10: Hwmon PMU                                                       :
> >    10.1: Basic parsing test                                            : Ok
> >    10.2: Parsing without PMU name                                      : Ok
> >    10.3: Parsing with PMU name                                         : Ok
> 
> This is better, thanks!
> 
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/tests/builtin-test.c | 4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
> > index 80375ca39a37a256..dfaff4185eb05a1a 100644
> > --- a/tools/perf/tests/builtin-test.c
> > +++ b/tools/perf/tests/builtin-test.c
> > @@ -567,10 +567,6 @@ static int __cmd_test(struct test_suite **suites, int argc, const char *argv[],
> >
> >                         for (unsigned int run = 0; run < runs_per_test; run++) {
> >                                 test_suite__for_each_test_case(*t, curr_test_case) {
> > -                                       if (!perf_test__matches(test_description(*t, curr_test_case),
> > -                                                               curr_suite, argc, argv))
> > -                                               continue;
> > -
> 
> This will change the behavior so that if a sub-test matches but the
> test suite as a whole doesn't the whole test suite will now be run.
> For example:
> 
> ```
> $ perf test list
> ...
>  39: CPU map
> 39.1: Synthesize cpu map
> 39.2: Print cpu map
> 39.3: Merge cpu map
> 39.4: Intersect cpu map
> 39.5: Equal cpu map
> ...
> $ perf test -v "Equal cpu map"
> 39.5: Equal cpu map                                                 : Ok
> ```
> 
> whereas with this change the whole of the "CPU map" test suite will be
> run. I think the condition:
> 
> ```
> if (!perf_test__matches(test_description(*t, curr_test_case),
> curr_suite, argc, argv))
> ```
> 
> should  be:
> 
> ```
> if (!perf_test__matches(test_description(*t, curr_test_case),
> curr_suite, argc, argv) &&
>     !perf_test__matches(test_description(*t, -1), curr_suite, argc, argv))
> ```
> 
> But you could avoid computing the extra perf_test__matches with a
> boolean as that test is done immediately before.

Oh, I overlooked the condition in the loop.  Will check the both can
skip if it only matched to some subtests.

Thanks,
Namhyung


      reply	other threads:[~2025-07-01 19:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 23:32 [PATCH 1/3] perf test: Check test suite description only Namhyung Kim
2025-06-30 23:32 ` [PATCH 2/3] perf test: Add libsubcmd help tests Namhyung Kim
2025-07-01 15:54   ` Ian Rogers
2025-07-01 19:56     ` Namhyung Kim
2025-06-30 23:32 ` [PATCH 3/3] perf tools: Fix use-after-free in help_unknown_cmd() Namhyung Kim
2025-07-01 16:03   ` Ian Rogers
2025-07-01 19:57     ` Namhyung Kim
2025-07-01 15:51 ` [PATCH 1/3] perf test: Check test suite description only Ian Rogers
2025-07-01 19:49   ` Namhyung Kim [this message]

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=aGQ7xzAQpRUghD35@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@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.