summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/testing_helpers.h
diff options
context:
space:
mode:
authorSimon Sundberg <simon.sundberg@kau.se>2024-10-10 15:27:08 +0200
committerAlexei Starovoitov <ast@kernel.org>2024-10-10 10:44:03 -0700
commit4192bb294f80928bc2257c7a2ff6c86a27de6807 (patch)
tree6725feb4516721b55cdc112a7c4287731154bee3 /tools/testing/selftests/bpf/testing_helpers.h
parent6cb86a0fdece87e126323ec1bb19deb16a52aedf (diff)
downloadlinux-next-4192bb294f80928bc2257c7a2ff6c86a27de6807.tar.gz
linux-next-4192bb294f80928bc2257c7a2ff6c86a27de6807.zip
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>
Diffstat (limited to 'tools/testing/selftests/bpf/testing_helpers.h')
-rw-r--r--tools/testing/selftests/bpf/testing_helpers.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/testing_helpers.h b/tools/testing/selftests/bpf/testing_helpers.h
index d55f6ab12433..46d7f7089f63 100644
--- a/tools/testing/selftests/bpf/testing_helpers.h
+++ b/tools/testing/selftests/bpf/testing_helpers.h
@@ -38,6 +38,8 @@ int unload_bpf_testmod(bool verbose);
int kern_sync_rcu(void);
int finit_module(int fd, const char *param_values, int flags);
int delete_module(const char *name, int flags);
+int load_module(const char *path, bool verbose);
+int unload_module(const char *name, bool verbose);
static inline __u64 get_time_ns(void)
{