Commit a605a6bb authored by Wang Yufen's avatar Wang Yufen Committed by Andrii Nakryiko

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: default avatarWang Yufen <wangyufen@huawei.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/1664169131-32405-6-git-send-email-wangyufen@huawei.com
parent 675bc8ab
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment