mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-07-19 21:40:29 +02:00
[ Upstream commit45db310984] Moving test_progs helpers to testing_helpers object so they can be used from test_verifier in following changes. Also adding missing ifndef header guard to testing_helpers.h header. Using stderr instead of env.stderr because un/load_bpf_testmod helpers will be used outside test_progs. Also at the point of calling them in test_progs the std files are not hijacked yet and stderr is the same as env.stderr. Acked-by: David Vernet <void@manifault.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20230515133756.1658301-4-jolsa@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org> Stable-dep-of:c9a83e76b5("selftests/bpf: Fix compile if backtrace support missing in libc") Signed-off-by: Sasha Levin <sashal@kernel.org>
34 lines
1.0 KiB
C
34 lines
1.0 KiB
C
/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
|
|
/* Copyright (C) 2020 Facebook, Inc. */
|
|
|
|
#ifndef __TESTING_HELPERS_H
|
|
#define __TESTING_HELPERS_H
|
|
|
|
#include <stdbool.h>
|
|
#include <bpf/bpf.h>
|
|
#include <bpf/libbpf.h>
|
|
|
|
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);
|
|
|
|
/*
|
|
* below function is exported for testing in prog_test test
|
|
*/
|
|
struct test_filter_set;
|
|
int parse_test_list(const char *s,
|
|
struct test_filter_set *test_set,
|
|
bool is_glob_pattern);
|
|
|
|
__u64 read_perf_max_sample_freq(void);
|
|
int load_bpf_testmod(bool verbose);
|
|
void unload_bpf_testmod(bool verbose);
|
|
int kern_sync_rcu(void);
|
|
|
|
#endif /* __TESTING_HELPERS_H */
|