OSDN Git Service

bpf: improve selftests and add tests for meta pointer
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 25 Sep 2017 00:25:53 +0000 (02:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Sep 2017 20:36:44 +0000 (13:36 -0700)
commit22c8852624fc90a90709d1237625ca57999c5092
tree103f6ecbf6e9a4b09a0ad25aa7e7916605ea4984
parentac29991ba137cc0e3b0f647fb41e79300230f15c
bpf: improve selftests and add tests for meta pointer

Add various test_verifier selftests, and a simple xdp/tc functional
test that is being attached to veths. Also let new versions of clang
use the recently added -mcpu=probe support [1] for the BPF target,
so that it can probe the underlying kernel for BPF insn set extensions.
We could also just set this options always, where older versions just
ignore it and give a note to the user that the -mcpu value is not
supported, but given emitting the note cannot be turned off from clang
side lets not confuse users running selftests with it, thus fallback
to the default generic one when we see that clang doesn't support it.
Also allow CPU option to be overridden in the Makefile from command
line.

  [1] https://github.com/llvm-mirror/llvm/commit/d7276a40d87b89aed89978dec6457a5b8b3a0db5

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/bpf_helpers.h
tools/testing/selftests/bpf/test_verifier.c
tools/testing/selftests/bpf/test_xdp_meta.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_xdp_meta.sh [new file with mode: 0755]