selftests/bpf: Add tests for libbpf-provided externs
authorAndrii Nakryiko <andriin@fb.com>
Sat, 14 Dec 2019 01:47:10 +0000 (17:47 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 16 Dec 2019 00:41:12 +0000 (16:41 -0800)
commit330a73a7b6ca93a415de1b7da68d7a0698fe4937
tree7f0220e2dd38b8f7c99c9b4780c97cd6513be982
parent2ad97d473db57ab866f0756806bb94515f7f2551
selftests/bpf: Add tests for libbpf-provided externs

Add a set of tests validating libbpf-provided extern variables. One crucial
feature that's tested is dead code elimination together with using invalid BPF
helper. CONFIG_MISSING is not supposed to exist and should always be specified
by libbpf as zero, which allows BPF verifier to correctly do branch pruning
and not fail validation, when invalid BPF helper is called from dead if branch.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20191214014710.3449601-5-andriin@fb.com
tools/testing/selftests/bpf/prog_tests/core_extern.c [new file with mode: 0644]
tools/testing/selftests/bpf/prog_tests/skeleton.c
tools/testing/selftests/bpf/progs/test_core_extern.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_skeleton.c