perf test: Move each test suite struct to its test
Rather than export test functions, export the test struct. Rename with a
suite__ prefix to avoid name collisions.
Committer notes:
Its '&suite__vectors_page', not '&suite__vectors_pages', noticed when
cross building to arm (32-bit).
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-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 2bf146e..3f93686 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -283,12 +283,12 @@ static int __test__bpf(int idx)
return ret;
}
-int test__bpf_subtest_get_nr(void)
+static int test__bpf_subtest_get_nr(void)
{
return (int)ARRAY_SIZE(bpf_testcase_table);
}
-const char *test__bpf_subtest_get_desc(int i)
+static const char *test__bpf_subtest_get_desc(int i)
{
if (i < 0 || i >= (int)ARRAY_SIZE(bpf_testcase_table))
return NULL;
@@ -325,7 +325,7 @@ static int check_env(void)
return 0;
}
-int test__bpf(struct test *test __maybe_unused, int i)
+static int test__bpf(struct test *test __maybe_unused, int i)
{
int err;
@@ -345,19 +345,29 @@ int test__bpf(struct test *test __maybe_unused, int i)
}
#else
-int test__bpf_subtest_get_nr(void)
+static int test__bpf_subtest_get_nr(void)
{
return 0;
}
-const char *test__bpf_subtest_get_desc(int i __maybe_unused)
+static const char *test__bpf_subtest_get_desc(int i __maybe_unused)
{
return NULL;
}
-int test__bpf(struct test *test __maybe_unused, int i __maybe_unused)
+static int test__bpf(struct test *test __maybe_unused, int i __maybe_unused)
{
pr_debug("Skip BPF test because BPF support is not compiled\n");
return TEST_SKIP;
}
#endif
+
+struct test suite__bpf = {
+ .desc = "BPF filter",
+ .func = test__bpf,
+ .subtest = {
+ .skip_if_fail = true,
+ .get_nr = test__bpf_subtest_get_nr,
+ .get_desc = test__bpf_subtest_get_desc,
+ },
+};