]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: fix incorrect users of create_and_get_cgroup
authorStanislav Fomichev <sdf@google.com>
Mon, 7 Jan 2019 17:46:46 +0000 (09:46 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 7 Jan 2019 21:15:55 +0000 (13:15 -0800)
commit87ccc315ed55c35fd33cb471eaa872852992d74b
tree85d622fbc4afb974a19887bc1dd2d92f3573816e
parent1b272dad18773de625ee5357bbee68ae4a4c923c
selftests/bpf: fix incorrect users of create_and_get_cgroup

We have some tests that assume create_and_get_cgroup returns -1 on error
which is incorrect (it returns 0 on error). Since fd might be zero in
general case, change create_and_get_cgroup to return -1 on error
and fix the users that assume 0 on error.

Fixes: 61301b3b754b ("tools/bpf: add a selftest for bpf_get_current_cgroup_id() helper")
Fixes: b863b48de3d4 ("bpf: use --cgroup in test_suite if supplied")
v2:
- instead of fixing the uses that assume -1 on error, convert the users
  that assume 0 on error (fd might be zero in general case)

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
12 files changed:
samples/bpf/test_cgrp2_attach2.c
samples/bpf/test_current_task_under_cgroup_user.c
tools/testing/selftests/bpf/cgroup_helpers.c
tools/testing/selftests/bpf/test_cgroup_storage.c
tools/testing/selftests/bpf/test_dev_cgroup.c
tools/testing/selftests/bpf/test_netcnt.c
tools/testing/selftests/bpf/test_skb_cgroup_id_user.c
tools/testing/selftests/bpf/test_sock.c
tools/testing/selftests/bpf/test_sock_addr.c
tools/testing/selftests/bpf/test_socket_cookie.c
tools/testing/selftests/bpf/test_tcpbpf_user.c
tools/testing/selftests/bpf/test_tcpnotify_user.c