summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/testing_helpers.h
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2021-11-03 15:08:43 -0700
committerAlexei Starovoitov <ast@kernel.org>2021-11-07 08:34:23 -0800
commitf87c1930ac2951d7fb3bacb523c24046c81015ed (patch)
tree2cfbb16f24c178803a18a3533a91050512b701c5 /tools/testing/selftests/bpf/testing_helpers.h
parentd8e86407e5fc6c3da1e336f89bd3e9bbc1c0cf60 (diff)
selftests/bpf: Merge test_stub.c into testing_helpers.c
Move testing prog and object load wrappers (bpf_prog_test_load and bpf_test_load_program) into testing_helpers.{c,h} and get rid of otherwise useless test_stub.c. Make testing_helpers.c available to non-test_progs binaries as well. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Dave Marchevsky <davemarchevsky@fb.com> Link: https://lore.kernel.org/bpf/20211103220845.2676888-11-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/testing_helpers.h')
-rw-r--r--tools/testing/selftests/bpf/testing_helpers.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/testing_helpers.h b/tools/testing/selftests/bpf/testing_helpers.h
index d4f8e749611b..f46ebc476ee8 100644
--- a/tools/testing/selftests/bpf/testing_helpers.h
+++ b/tools/testing/selftests/bpf/testing_helpers.h
@@ -6,3 +6,9 @@
int parse_num_list(const char *s, bool **set, int *set_len);
__u32 link_info_prog_id(const struct bpf_link *link, struct bpf_link_info *info);
+int bpf_prog_test_load(const char *file, enum bpf_prog_type type,
+ struct bpf_object **pobj, int *prog_fd);
+int bpf_test_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
+ size_t insns_cnt, const char *license,
+ __u32 kern_version, char *log_buf,
+ size_t log_buf_sz);