Skip to content

Commit 003be25

Browse files
JasonXingMartin KaFai Lau
authored andcommitted
selftests/bpf: Correct the check of join cgroup
Use ASSERT_OK_FD to check the return value of join cgroup, or else this test will pass even if the fd < 0. ASSERT_OK_FD can print the error message to the console. Suggested-by: Martin KaFai Lau <martin.lau@kernel.org> Signed-off-by: Jason Xing <kerneljasonxing@gmail.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Acked-by: Hou Tao <houtao1@huawei.com> Link: https://lore.kernel.org/all/6d62bd77-6733-40c7-b240-a1aeff55566c@linux.dev/ Link: https://patch.msgid.link/20250204051154.57655-1-kerneljasonxing@gmail.com
1 parent 0abff46 commit 003be25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/bpf/prog_tests/setget_sockopt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static void test_nonstandard_opt(int family)
202202
void test_setget_sockopt(void)
203203
{
204204
cg_fd = test__join_cgroup(CG_NAME);
205-
if (cg_fd < 0)
205+
if (!ASSERT_OK_FD(cg_fd, "join cgroup"))
206206
return;
207207

208208
if (create_netns())

0 commit comments

Comments
 (0)