summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_sysctl.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2020-08-01 00:09:14 +0200
committerAlexei Starovoitov <ast@kernel.org>2020-08-02 05:20:59 +0200
commit4939b2847d26c025e2e2118744226967f239a1ac (patch)
tree0051e49fa8855a6a93da7dbcd4b7d054281d731b /tools/testing/selftests/bpf/test_sysctl.c
parentDocumentation/bpf: Use valid and new links in index.rst (diff)
downloadlinux-4939b2847d26c025e2e2118744226967f239a1ac.tar.xz
linux-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_sysctl.c')
-rw-r--r--tools/testing/selftests/bpf/test_sysctl.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/tools/testing/selftests/bpf/test_sysctl.c b/tools/testing/selftests/bpf/test_sysctl.c
index d196e2a4a6e0..a20a919244c0 100644
--- a/tools/testing/selftests/bpf/test_sysctl.c
+++ b/tools/testing/selftests/bpf/test_sysctl.c
@@ -1619,16 +1619,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;