lkml.org 
[lkml]   [2021]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 06/22] perf test: Add helper functions for abstraction.
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 ?

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-20 14:34    [W:0.334 / U:1.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site