diff options
| author | Mykyta Yatsenko <yatsenko@meta.com> | 2025-04-09 00:44:17 +0100 |
|---|---|---|
| committer | Andrii Nakryiko <andrii@kernel.org> | 2025-04-09 16:16:56 -0700 |
| commit | b8390dd1e09e1abf73299209e9e7bcc2585b88e6 (patch) | |
| tree | 0fef4346219cd350de9cc77af900fd97fcfc6cc4 /tools/testing/selftests/bpf/progs/test_btf_ext.c | |
| parent | libbpf: Add getters for BTF.ext func and line info (diff) | |
| download | linux-b8390dd1e09e1abf73299209e9e7bcc2585b88e6.tar.gz linux-b8390dd1e09e1abf73299209e9e7bcc2585b88e6.zip | |
selftests/bpf: Add BTF.ext line/func info getter tests
Add selftests checking that line and func info retrieved by newly added
libbpf APIs are the same as returned by kernel via bpf_prog_get_info_by_fd.
Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250408234417.452565-3-mykyta.yatsenko5@gmail.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_btf_ext.c')
| -rw-r--r-- | tools/testing/selftests/bpf/progs/test_btf_ext.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_btf_ext.c b/tools/testing/selftests/bpf/progs/test_btf_ext.c new file mode 100644 index 000000000000..cdf20331db04 --- /dev/null +++ b/tools/testing/selftests/bpf/progs/test_btf_ext.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright (c) 2025 Meta Platforms Inc. */ + +#include <linux/bpf.h> +#include <bpf/bpf_helpers.h> +#include "bpf_misc.h" + +char _license[] SEC("license") = "GPL"; + +__noinline static void f0(void) +{ + __u64 a = 1; + + __sink(a); +} + +SEC("xdp") +__u64 global_func(struct xdp_md *xdp) +{ + f0(); + return XDP_DROP; +} |
