]> git.baikalelectronics.ru Git - kernel.git/commitdiff
perf test: Add skip reason to test case.
authorIan Rogers <irogers@google.com>
Thu, 4 Nov 2021 06:41:54 +0000 (23:41 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 13 Nov 2021 13:32:26 +0000 (10:32 -0300)
This doesn't exist in kunit, but will ease the transition from perf
tests.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: Daniel Latypov <dlatypov@google.com>
Cc: David Gow <davidgow@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20211104064208.3156807-9-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/builtin-test.c
tools/perf/tests/tests.h

index a6d84feba48306ddee6afabcf89826b3abbcd739..db76d7d10749435a0a7e067fff9a8097200727e4 100644 (file)
@@ -142,6 +142,9 @@ static const char *skip_reason(const struct test_suite *t, int subtest)
        if (t->subtest.skip_reason)
                return t->subtest.skip_reason(subtest);
 
+       if (t->test_cases && subtest >= 0)
+               return t->test_cases[subtest].skip_reason;
+
        return NULL;
 }
 
index 71b8d2c88e5c04e8bac11c711a74f5e45dfae748..f87129b63d9236854298f9bd4eb47cd05893cf44 100644 (file)
@@ -34,6 +34,7 @@ typedef int (*test_fnptr)(struct test_suite *, int);
 struct test_case {
        const char *name;
        const char *desc;
+       const char *skip_reason;
        test_fnptr run_case;
 };
 
@@ -61,7 +62,15 @@ struct test_suite {
                .run_case = test__##_name,              \
        }
 
-#define DEFINE_SUITE(description, _name)                       \
+#define TEST_CASE_REASON(description, _name, _reason)  \
+       {                                               \
+               .name = #_name,                         \
+               .desc = description,                    \
+               .run_case = test__##_name,              \
+               .skip_reason = _reason,                 \
+       }
+
+#define DEFINE_SUITE(description, _name)               \
        struct test_case tests__##_name[] = {           \
                TEST_CASE(description, _name),          \
                {       .name = NULL, }                 \