selftests/bpf: Add checking of raw type dump in BTF writer APIs selftests
authorAndrii Nakryiko <andriin@fb.com>
Thu, 5 Nov 2020 04:33:56 +0000 (20:33 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 6 Nov 2020 02:37:30 +0000 (18:37 -0800)
commit1306c980cf892bc17e7296d3e9ab8e9082f893a1
tree4d0fd52e7c7133816bb205c02401996efdfc262f
parent197389da2fbfbc3cefb229268c32d858d9575c96
selftests/bpf: Add checking of raw type dump in BTF writer APIs selftests

Add re-usable btf_helpers.{c,h} to provide BTF-related testing routines. Start
with adding a raw BTF dumping helpers.

Raw BTF dump is the most succinct and at the same time a very human-friendly
way to validate exact contents of BTF types. Cross-validate raw BTF dump and
writable BTF in a single selftest. Raw type dump checks also serve as a good
self-documentation.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20201105043402.2530976-7-andrii@kernel.org
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/btf_helpers.c [new file with mode: 0644]
tools/testing/selftests/bpf/btf_helpers.h [new file with mode: 0644]
tools/testing/selftests/bpf/prog_tests/btf_write.c