aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_sock.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2020-07-31 15:09:14 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-08-01 20:20:59 -0700
commit4939b2847d26c025e2e2118744226967f239a1ac (patch)
tree0051e49fa8855a6a93da7dbcd4b7d054281d731b /tools/testing/selftests/bpf/test_sock.c
parentDocumentation/bpf: Use valid and new links in index.rst (diff)
downloadlinux-dev-4939b2847d26c025e2e2118744226967f239a1ac.tar.xz
linux-dev-4939b2847d26c025e2e2118744226967f239a1ac.zip
bpf, selftests: Use single cgroup helpers for both test_sockmap/progs
Nearly every user of cgroup helpers does the same sequence of API calls. So push these into a single helper cgroup_setup_and_join. The cases that do a bit of extra logic are test_progs which currently uses an env variable to decide if it needs to setup the cgroup environment or can use an existingi environment. And then tests that are doing cgroup tests themselves. We skip these cases for now. Signed-off-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/159623335418.30208.15807461815525100199.stgit@john-XPS-13-9370
Diffstat (limited to 'tools/testing/selftests/bpf/test_sock.c')
-rw-r--r--tools/testing/selftests/bpf/test_sock.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c
index 52bf14955797..9613f7538840 100644
--- a/tools/testing/selftests/bpf/test_sock.c
+++ b/tools/testing/selftests/bpf/test_sock.c
@@ -464,16 +464,10 @@ int main(int argc, char **argv)
int cgfd = -1;
int err = 0;
- if (setup_cgroup_environment())
- goto err;
-
- cgfd = create_and_get_cgroup(CG_PATH);
+ cgfd = cgroup_setup_and_join(CG_PATH);
if (cgfd < 0)
goto err;
- if (join_cgroup(CG_PATH))
- goto err;
-
if (run_tests(cgfd))
goto err;