selftests/bpf: Provide a generic [un]load_module helper
authorSimon Sundberg <simon.sundberg@kau.se>
Thu, 10 Oct 2024 13:27:08 +0000 (15:27 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 10 Oct 2024 17:44:03 +0000 (10:44 -0700)
commit4192bb294f80928bc2257c7a2ff6c86a27de6807
tree6725feb4516721b55cdc112a7c4287731154bee3
parent6cb86a0fdece87e126323ec1bb19deb16a52aedf
selftests/bpf: Provide a generic [un]load_module helper

Generalize the previous [un]load_bpf_testmod() helpers (in
testing_helpers.c) to the more generic [un]load_module(), which can
load an arbitrary kernel module by name. This allows future selftests
to more easily load custom kernel modules other than bpf_testmod.ko.
Refactor [un]load_bpf_testmod() to wrap this new helper.

Signed-off-by: Simon Sundberg <simon.sundberg@kau.se>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20241010-fix-kfunc-btf-caching-for-modules-v2-2-745af6c1af98@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/testing_helpers.c
tools/testing/selftests/bpf/testing_helpers.h