]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: sockmap, add selftests
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 23 Apr 2018 21:30:38 +0000 (14:30 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 24 Apr 2018 22:06:20 +0000 (00:06 +0200)
commit25017cdeb1ee235d936f451fc89bc093ad5bcb1a
tree954672926f41481d6cd3af9517c99a15359e0416
parent5355c87637e406c1b8dda8f93dce835ccf3cd452
bpf: sockmap, add selftests

This adds a new test program test_sockmap which is the old sample
sockmap program. By moving the sample program here we can now run it
as part of the self tests suite. To support this a populate_progs()
routine is added to load programs and maps which was previously done
with load_bpf_file(). This is needed because self test libs do not
provide a similar routine. Also we now use the cgroup_helpers
routines to manage cgroup use instead of manually creating one and
supplying it to the CLI.

Notice we keep the CLI around though because it is useful for dbg
and specialized testing.

To run use ./test_sockmap and the result should be,

Summary 660 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/include/uapi/linux/bpf.h
tools/include/uapi/linux/if_link.h
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/test_sockmap.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_sockmap_kern.c [new file with mode: 0644]