selftests/bpf: test_progs: add test__join_cgroup helper
authorStanislav Fomichev <sdf@google.com>
Wed, 4 Sep 2019 16:25:04 +0000 (09:25 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 6 Sep 2019 16:59:05 +0000 (09:59 -0700)
commit88dadc632763bdccddf99d8454aa3a7932605f00
tree70641d1344b6ba00d70a9012812daaee43329eb5
parent618916a4bf169450e4680173a4b105a1816a7d6d
selftests/bpf: test_progs: add test__join_cgroup helper

test__join_cgroup() combines the following operations that usually
go hand in hand and returns cgroup fd:

  * setup cgroup environment (make sure cgroupfs is mounted)
  * mkdir cgroup
  * join cgroup

It also marks a test as a "cgroup cleanup needed" and removes cgroup
state after the test is done.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/test_progs.c
tools/testing/selftests/bpf/test_progs.h