selftests/bpf: Add test for resolve_btfids
authorJiri Olsa <jolsa@kernel.org>
Sat, 11 Jul 2020 21:53:29 +0000 (23:53 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 13 Jul 2020 17:42:03 +0000 (10:42 -0700)
commitcc15a20d5f3abc3cbd7911b70156b7b9e2bc7d41
tree72725e347309aa4c0ad196b34978f359c54d2ab6
parente5a0516ec9681daf5c1f0d05144d21430b6ca6d7
selftests/bpf: Add test for resolve_btfids

Adding resolve_btfids test under test_progs suite.

It's possible to use btf_ids.h header and its logic in
user space application, so we can add easy test for it.

The test defines BTF_ID_LIST and checks it gets properly
resolved.

For this reason the test_progs binary (and other binaries
that use TRUNNER* macros) is processed with resolve_btfids
tool, which resolves BTF IDs in .BTF_ids section. The BTF
data are taken from btf_data.o object rceated from
progs/btf_data.c.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200711215329.41165-10-jolsa@kernel.org
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/prog_tests/resolve_btfids.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/btf_data.c [new file with mode: 0644]