lkml.org 
[lkml]   [2021]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [PATCH v2 06/22] perf test: Add helper functions for abstraction.
On Wed, Oct 20, 2021 at 5:34 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Wed, Oct 13, 2021 at 10:45:48AM -0700, Ian Rogers wrote:
>
> SNIP
>
> > else
> > pr_debug("%s subtest %d:", t->desc, subtest + 1);
> > @@ -218,11 +257,10 @@ static int test_and_print(struct test_suite *t, bool force_skip, int subtest)
> > pr_info(" Ok\n");
> > break;
> > case TEST_SKIP: {
> > - const char *skip_reason = NULL;
> > - if (t->subtest.skip_reason)
> > - skip_reason = t->subtest.skip_reason(subtest);
> > - if (skip_reason)
> > - color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (%s)\n", skip_reason);
> > + const char *reason = skip_reason(t, subtest);
> > +
> > + if (reason)
> > + color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (%s)\n", reason);
> > else
> > color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n");
> > }
> > @@ -397,7 +435,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
> > int width = shell_tests__max_desc_width();
> >
> > for_each_test(j, k, t) {
> > - int len = strlen(t->desc);
> > + int len = strlen(test_description(t, -1));
> >
> > if (width < len)
> > width = len;
> > @@ -407,17 +445,15 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
> > int curr = i++, err;
> > int subi;
> >
> > - if (!perf_test__matches(t->desc, curr, argc, argv)) {
> > + if (!perf_test__matches(test_description(t, -1), curr, argc, argv)) {
> > bool skip = true;
> > int subn;
> >
> > - if (!t->subtest.get_nr)
> > - continue;
> > -
> > - subn = t->subtest.get_nr();
> > + subn = num_subtests(t);
>
> should you call continue on !subn ?

It's not necessary. When subn == 0 then the loop won't be taken and
skip == true, so the immediately after "if (skip) continue;" will
happen.

Thanks,
Ian

> jirka
>
> >
> > for (subi = 0; subi < subn; subi++) {
> > - if (perf_test__matches(t->subtest.get_desc(subi), curr, argc, argv))
> > + if (perf_test__matches(test_description(t, subi),
> > + curr, argc, argv))
> > skip = false;
> > }
> >
> > @@ -425,22 +461,23 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
> > continue;
> > }
> >
>
> SNIP
>

\
 
 \ /
  Last update: 2021-10-26 00:36    [W:0.055 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site