@@ -215,28 +215,46 @@ out:
return ret;
}
-int test__bpf(void)
+int test__bpf_subtest_get_nr(void)
+{
+ return (int)ARRAY_SIZE(bpf_testcase_table);
+}
+
+const char *test__bpf_subtest_get_desc(int i)
+{
+ if (i < 0 || i >= (int)ARRAY_SIZE(bpf_testcase_table))
+ return NULL;
+ return bpf_testcase_table[i].desc;
+}
+
+int test__bpf_subtest(int i)
{
- unsigned int i;
int err;
+ if (i < 0 || i >= (int)ARRAY_SIZE(bpf_testcase_table))
+ return TEST_FAIL;
+
if (geteuid() != 0) {
pr_debug("Only root can run BPF test\n");
return TEST_SKIP;
}
- for (i = 0; i < ARRAY_SIZE(bpf_testcase_table); i++) {
- err = __test__bpf(i);
+ err = __test__bpf(i);
+ return err;
+}
- if (err != TEST_OK)
- return err;
- }
+#else
+int test__bpf_subtest_get_nr(void)
+{
+ return 0;
+}
- return TEST_OK;
+const char *test__bpf_subtest_get_desc(int i __maybe_unused)
+{
+ return NULL;
}
-#else
-int test__bpf(void)
+int test__bpf_subtest(int i __maybe_unused)
{
pr_debug("Skip BPF test because BPF support is not compiled\n");
return TEST_SKIP;
@@ -173,7 +173,13 @@ static struct test generic_tests[] = {
},
{
.desc = "Test BPF filter",
- .func = test__bpf,
+ .need_subtests = true,
+ .subtest = {
+ .skip_if_fail = true,
+ .get_nr = test__bpf_subtest_get_nr,
+ .get_desc = test__bpf_subtest_get_desc,
+ .func = test__bpf_subtest,
+ },
},
{
.func = NULL,
@@ -84,7 +84,10 @@ const char *test__llvm_subtest_get_desc(int i);
int test__llvm_subtest_get_nr(void);
int test__llvm_subtest(int i);
-int test__bpf(void);
+const char *test__bpf_subtest_get_desc(int i);
+int test__bpf_subtest_get_nr(void);
+int test__bpf_subtest(int i);
+
int test_session_topology(void);
#if defined(__arm__) || defined(__aarch64__)