Skip to content

Commit

Permalink
bpf: add initial suite for selftests
Browse files Browse the repository at this point in the history
Add a start of a test suite for kernel selftests. This moves test_verifier
and test_maps over to tools/testing/selftests/bpf/ along with various
code improvements and also adds a script for invoking test_bpf module.
The test suite can simply be run via selftest framework, f.e.:

  # cd tools/testing/selftests/bpf/
  # make
  # make run_tests

Both test_verifier and test_maps were kind of misplaced in samples/bpf/
directory and we were looking into adding them to selftests for a while
now, so it can be picked up by kbuild bot et al and hopefully also get
more exposure and thus new test case additions.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
borkmann authored and davem330 committed Oct 18, 2016
1 parent 1a776b9 commit 5aa5bd1
Show file tree
Hide file tree
Showing 12 changed files with 1,096 additions and 765 deletions.
3 changes: 2 additions & 1 deletion MAINTAINERS
Expand Up @@ -2521,6 +2521,8 @@ L: netdev@vger.kernel.org
L: linux-kernel@vger.kernel.org
S: Supported
F: kernel/bpf/
F: tools/testing/selftests/bpf/
F: lib/test_bpf.c

BROADCOM B44 10/100 ETHERNET DRIVER
M: Michael Chan <michael.chan@broadcom.com>
Expand Down Expand Up @@ -8413,7 +8415,6 @@ F: include/uapi/linux/net_namespace.h
F: tools/net/
F: tools/testing/selftests/net/
F: lib/random32.c
F: lib/test_bpf.c

NETWORKING [IPv4/IPv6]
M: "David S. Miller" <davem@davemloft.net>
Expand Down
3 changes: 0 additions & 3 deletions samples/bpf/Makefile
Expand Up @@ -2,7 +2,6 @@
obj- := dummy.o

# List of programs to build
hostprogs-y := test_verifier test_maps
hostprogs-y += sock_example
hostprogs-y += fds_example
hostprogs-y += sockex1
Expand All @@ -28,8 +27,6 @@ hostprogs-y += test_current_task_under_cgroup
hostprogs-y += trace_event
hostprogs-y += sampleip

test_verifier-objs := test_verifier.o libbpf.o
test_maps-objs := test_maps.o libbpf.o
sock_example-objs := sock_example.o libbpf.o
fds_example-objs := bpf_load.o libbpf.o fds_example.o
sockex1-objs := bpf_load.o libbpf.o sockex1_user.o
Expand Down

0 comments on commit 5aa5bd1

Please sign in to comment.