selftests/bpf: add a cgroup storage test
authorRoman Gushchin <guro@fb.com>
Thu, 2 Aug 2018 21:27:29 +0000 (14:27 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 2 Aug 2018 22:47:33 +0000 (00:47 +0200)
commit68cfa3ac6b8db2782300ad0d699da27aaa2ac9fb
treecc536853c2a154d2b0f036a840227e2d0f22578a
parentd4c9f573537506530019c505c8b6097a7d7a5fab
selftests/bpf: add a cgroup storage test

Implement a test to cover the cgroup storage functionality.
The test implements a bpf program which drops every second packet
by using the cgroup storage as a persistent storage.

The test also use the userspace API to check the data
in the cgroup storage, alter it, and check that the loaded
and attached bpf program sees the update.

Expected output:
  $ ./test_cgroup_storage
  test_cgroup_storage:PASS

Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/test_cgroup_storage.c [new file with mode: 0644]