selftests/bpf: validate struct_ops early failure detection logic
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 7 May 2024 00:13:34 +0000 (17:13 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Tue, 7 May 2024 23:21:59 +0000 (16:21 -0700)
commit41df0733ea414a49094258adab4d600db0420731
treeaeec94caec6a45199bcc6668e4b00da233894564
parentc78420bafe7cf9ce14fa7ceb40ce62e1372e661d
selftests/bpf: validate struct_ops early failure detection logic

Add a simple test that validates that libbpf will reject isolated
struct_ops program early with helpful warning message.

Also validate that explicit use of such BPF program through BPF skeleton
after BPF object is open won't trigger any warnings.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240507001335.1445325-7-andrii@kernel.org
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_struct_ops_module.c
tools/testing/selftests/bpf/progs/struct_ops_forgotten_cb.c [new file with mode: 0644]