aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2021-11-04 06:41:54 +0000
committerArnaldo Carvalho de Melo <[email protected]>2021-11-13 13:32:26 +0000
commit9be56d30802f6da22c7afe7e70a77a3bdda6561b (patch)
tree6ceb10994ab9e238ad99ae84a7e0e3b1eae25243
parentperf test: Add test case struct. (diff)
downloadkernel-9be56d30802f6da22c7afe7e70a77a3bdda6561b.tar.gz
kernel-9be56d30802f6da22c7afe7e70a77a3bdda6561b.zip
perf test: Add skip reason to test case.
This doesn't exist in kunit, but will ease the transition from perf tests. Signed-off-by: Ian Rogers <[email protected]> Tested-by: Sohaib Mohamed <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Brendan Higgins <[email protected]> Cc: Daniel Latypov <[email protected]> Cc: David Gow <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jin Yao <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/tests/builtin-test.c3
-rw-r--r--tools/perf/tests/tests.h11
2 files changed, 13 insertions, 1 deletions
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index a6d84feba483..db76d7d10749 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -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;
}
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 71b8d2c88e5c..f87129b63d92 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -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, } \