aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_btf_haskv.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-11-20tools/bpf: enhance test_btf file testing to test func infoYonghong Song1-2/+14
Change the bpf programs test_btf_haskv.c and test_btf_nokv.c to have two sections, and enhance test_btf.c test_file feature to test btf func_info returned by the kernel. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-07-25bpf: Introduce BPF_ANNOTATE_KV_PAIRMartin KaFai Lau1-5/+2
This patch introduces BPF_ANNOTATE_KV_PAIR to signal the bpf loader about the btf key_type and value_type of a bpf map. Please refer to the changes in test_btf_haskv.c for its usage. Both iproute2 and libbpf loader will then have the same convention to find out the map's btf_key_type_id and btf_value_type_id from a map's name. Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-04-19bpf: btf: Add BTF testsMartin KaFai Lau1-0/+48
This patch tests the BTF loading, map_create with BTF and the changes in libbpf. -r: Raw tests that test raw crafted BTF data -f: Test LLVM compiled bpf prog with BTF data -g: Test BPF_OBJ_GET_INFO_BY_FD for btf_fd -p: Test pretty print The tools/testing/selftests/bpf/Makefile will probe for BTF support in llc and pahole before generating debug info (-g) and convert them to BTF. You can supply the BTF supported binary through the following make variables: LLC, BTF_PAHOLE and LLVM_OBJCOPY. LLC: The lastest llc with -mattr=dwarfris support for the bpf target. It is only in the master of the llvm repo for now. BTF_PAHOLE: The modified pahole with BTF support: https://github.com/iamkafai/pahole/tree/btf To add a BTF section: "pahole -J bpf_prog.o" LLVM_OBJCOPY: Any llvm-objcopy should do Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Alexei Starovoitov <ast@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>