[PATCH v2 5/5] selftests/bpf: Skip BPF_PROG_TYPE_SECCOMP-related tests
From: Hengqi Chen
Date: Sun Oct 15 2023 - 21:48:04 EST
We only allow BPF_PROG_TYPE_SECCOMP progs to be loaded via
seccomp syscall. Skip related test on BPF side.
Signed-off-by: Hengqi Chen <hengqi.chen@xxxxxxxxx>
---
tools/testing/selftests/bpf/prog_tests/libbpf_probes.c | 3 ++-
tools/testing/selftests/bpf/prog_tests/libbpf_str.c | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/libbpf_probes.c b/tools/testing/selftests/bpf/prog_tests/libbpf_probes.c
index 9f766ddd946a..134ae042c4da 100644
--- a/tools/testing/selftests/bpf/prog_tests/libbpf_probes.c
+++ b/tools/testing/selftests/bpf/prog_tests/libbpf_probes.c
@@ -28,7 +28,8 @@ void test_libbpf_probe_prog_types(void)
enum bpf_prog_type prog_type = (enum bpf_prog_type)e->val;
int res;
- if (prog_type == BPF_PROG_TYPE_UNSPEC)
+ if (prog_type == BPF_PROG_TYPE_UNSPEC ||
+ prog_type == BPF_PROG_TYPE_SECCOMP)
continue;
if (!test__start_subtest(prog_type_name))
diff --git a/tools/testing/selftests/bpf/prog_tests/libbpf_str.c b/tools/testing/selftests/bpf/prog_tests/libbpf_str.c
index c440ea3311ed..35365500c326 100644
--- a/tools/testing/selftests/bpf/prog_tests/libbpf_str.c
+++ b/tools/testing/selftests/bpf/prog_tests/libbpf_str.c
@@ -186,6 +186,9 @@ static void test_libbpf_bpf_prog_type_str(void)
const char *prog_type_str;
char buf[256];
+ if (prog_type == BPF_PROG_TYPE_SECCOMP)
+ continue;
+
prog_type_name = btf__str_by_offset(btf, e->name_off);
prog_type_str = libbpf_bpf_prog_type_str(prog_type);
ASSERT_OK_PTR(prog_type_str, prog_type_name);
--
2.34.1