mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
selftests/bpf: Convert sockopt_multi test to ASSERT_* macros
Convert the selftest to use the preferred ASSERT_* macros instead of the deprecated CHECK(). Signed-off-by: Wang Yufen <wangyufen@huawei.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/1664169131-32405-6-git-send-email-wangyufen@huawei.com
This commit is contained in:
parent
675bc8abe1
commit
a605a6bbcc
1 changed files with 5 additions and 5 deletions
|
@ -303,11 +303,11 @@ void test_sockopt_multi(void)
|
|||
int err = -1;
|
||||
|
||||
cg_parent = test__join_cgroup("/parent");
|
||||
if (CHECK_FAIL(cg_parent < 0))
|
||||
if (!ASSERT_GE(cg_parent, 0, "join_cgroup /parent"))
|
||||
goto out;
|
||||
|
||||
cg_child = test__join_cgroup("/parent/child");
|
||||
if (CHECK_FAIL(cg_child < 0))
|
||||
if (!ASSERT_GE(cg_child, 0, "join_cgroup /parent/child"))
|
||||
goto out;
|
||||
|
||||
obj = bpf_object__open_file("sockopt_multi.bpf.o", NULL);
|
||||
|
@ -319,11 +319,11 @@ void test_sockopt_multi(void)
|
|||
goto out;
|
||||
|
||||
sock_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (CHECK_FAIL(sock_fd < 0))
|
||||
if (!ASSERT_GE(sock_fd, 0, "socket"))
|
||||
goto out;
|
||||
|
||||
CHECK_FAIL(run_getsockopt_test(obj, cg_parent, cg_child, sock_fd));
|
||||
CHECK_FAIL(run_setsockopt_test(obj, cg_parent, cg_child, sock_fd));
|
||||
ASSERT_OK(run_getsockopt_test(obj, cg_parent, cg_child, sock_fd), "getsockopt_test");
|
||||
ASSERT_OK(run_setsockopt_test(obj, cg_parent, cg_child, sock_fd), "setsockopt_test");
|
||||
|
||||
out:
|
||||
close(sock_fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue