From: Prashant Bhole Date: Thu, 31 May 2018 04:42:37 +0000 (+0900) Subject: selftests/bpf: test_sockmap, join cgroup in selftest mode X-Git-Tag: v4.18-rc1~114^2~9^2~11^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=035b37ff2c6e3577b8ad7d5c3cc4619ab74559bb;p=thirdparty%2Fkernel%2Fstable.git selftests/bpf: test_sockmap, join cgroup in selftest mode In case of selftest mode, temporary cgroup environment is created but cgroup is not joined. It causes test failures. Fixed by joining the cgroup Fixes: 16962b2404ac ("bpf: sockmap, add selftests") Acked-by: John Fastabend Signed-off-by: Prashant Bhole Signed-off-by: Daniel Borkmann --- diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index 7b2008a144cb3..7f9ca79aadbcc 100644 --- a/tools/testing/selftests/bpf/test_sockmap.c +++ b/tools/testing/selftests/bpf/test_sockmap.c @@ -1344,6 +1344,11 @@ static int __test_suite(char *bpf_file) return cg_fd; } + if (join_cgroup(CG_PATH)) { + fprintf(stderr, "ERROR: failed to join cgroup\n"); + return -EINVAL; + } + /* Tests basic commands and APIs with range of iov values */ txmsg_start = txmsg_end = 0; err = test_txmsg(cg_fd);