selftests/bpf: validate nulled-out struct_ops program is handled properly
authorAndrii Nakryiko <andrii@kernel.org>
Sun, 28 Apr 2024 03:09:54 +0000 (20:09 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Mon, 29 Apr 2024 23:48:33 +0000 (16:48 -0700)
commit1bba3b3d373dbafae891e7cb06b8c82c8d62aba1
treea0dbfaaf0e1970a93b7b2536632329019a219d49
parentf973fccd43d34b096077d5d21d051ef75b22a7ea
selftests/bpf: validate nulled-out struct_ops program is handled properly

Add a selftests validating that it's possible to have some struct_ops
callback set declaratively, then disable it (by setting to NULL)
programmatically. Libbpf should detect that such program should
not be loaded. Otherwise, it will unnecessarily fail the loading
when the host kernel does not have the type information.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240428030954.3918764-2-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_module.c