selftests/bpf: Add map linking selftest
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 23 Apr 2021 18:13:47 +0000 (11:13 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 23 Apr 2021 21:05:27 +0000 (14:05 -0700)
commit3b2ad502256b7f0f9415978fd7f158656d11401e
tree56a5b1fd7108c9c6d434707531438c353bc68d63
parent14f1aae17ee13d08315873d4b68d573e91df892f
selftests/bpf: Add map linking selftest

Add selftest validating various aspects of statically linking BTF-defined map
definitions. Legacy map definitions do not support extern resolution between
object files. Some of the aspects validated:
  - correct resolution of extern maps against concrete map definitions;
  - extern maps can currently only specify map type and key/value size and/or
    type information;
  - weak concrete map definitions are resolved properly.

Static map definitions are not yet supported by libbpf, so they are not
explicitly tested, though manual testing showes that BPF linker handles them
properly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210423181348.1801389-18-andrii@kernel.org
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/prog_tests/linked_maps.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/linked_maps1.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/linked_maps2.c [new file with mode: 0644]