Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in bind_perm

bind_perm uses the `CHECK` calls even though the use of
ASSERT_ series of macros is preferred in the bpf selftests.

This patch replaces all `CHECK` calls for equivalent `ASSERT_`
macro calls.

Signed-off-by: Yuran Pereira <yuran.pereira@hotmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/GV1PR10MB656314F467E075A106CA02BFE8BBA@GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM

authored by

Yuran Pereira and committed by
Andrii Nakryiko
3ec1114a b0e2a039

+2 -4
+2 -4
tools/testing/selftests/bpf/prog_tests/bind_perm.c
··· 9 9 #include "cap_helpers.h" 10 10 #include "bind_perm.skel.h" 11 11 12 - static int duration; 13 - 14 12 static int create_netns(void) 15 13 { 16 14 if (!ASSERT_OK(unshare(CLONE_NEWNET), "create netns")) ··· 25 27 int fd = -1; 26 28 27 29 fd = socket(family, SOCK_STREAM, 0); 28 - if (CHECK(fd < 0, "fd", "errno %d", errno)) 30 + if (!ASSERT_GE(fd, 0, "socket")) 29 31 goto close_socket; 30 32 31 33 if (family == AF_INET) { ··· 58 60 return; 59 61 60 62 cgroup_fd = test__join_cgroup("/bind_perm"); 61 - if (CHECK(cgroup_fd < 0, "cg-join", "errno %d", errno)) 63 + if (!ASSERT_GE(cgroup_fd, 0, "test__join_cgroup")) 62 64 return; 63 65 64 66 skel = bind_perm__open_and_load();