Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH bpf-next v1] selftests/bpf: correct the check of join cgroup
@ 2025-02-04  5:11 Jason Xing
  2025-02-05  2:42 ` Hou Tao
  2025-02-07  5:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jason Xing @ 2025-02-04  5:11 UTC (permalink / raw)
  To: ast, daniel, andrii, eddyz87, mykolal, martin.lau, song,
	yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah
  Cc: bpf, linux-kselftest, Jason Xing, Martin KaFai Lau

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.

Link: https://lore.kernel.org/all/6d62bd77-6733-40c7-b240-a1aeff55566c@linux.dev/
Suggested-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
---
 tools/testing/selftests/bpf/prog_tests/setget_sockopt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c b/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c
index e12255121c15..e4dac529d424 100644
--- a/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c
+++ b/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c
@@ -202,7 +202,7 @@ static void test_nonstandard_opt(int family)
 void test_setget_sockopt(void)
 {
 	cg_fd = test__join_cgroup(CG_NAME);
-	if (cg_fd < 0)
+	if (!ASSERT_OK_FD(cg_fd, "join cgroup"))
 		return;
 
 	if (create_netns())
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next v1] selftests/bpf: correct the check of join cgroup
  2025-02-04  5:11 [PATCH bpf-next v1] selftests/bpf: correct the check of join cgroup Jason Xing
@ 2025-02-05  2:42 ` Hou Tao
  2025-02-07  5:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Hou Tao @ 2025-02-05  2:42 UTC (permalink / raw)
  To: Jason Xing, ast, daniel, andrii, eddyz87, mykolal, martin.lau,
	song, yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
	shuah
  Cc: bpf, linux-kselftest, Martin KaFai Lau



On 2/4/2025 1:11 PM, Jason Xing wrote:
> 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.
>
> Link: https://lore.kernel.org/all/6d62bd77-6733-40c7-b240-a1aeff55566c@linux.dev/
> Suggested-by: Martin KaFai Lau <martin.lau@kernel.org>
> Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>

Acked-by: Hou Tao <houtao1@huawei.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next v1] selftests/bpf: correct the check of join cgroup
  2025-02-04  5:11 [PATCH bpf-next v1] selftests/bpf: correct the check of join cgroup Jason Xing
  2025-02-05  2:42 ` Hou Tao
@ 2025-02-07  5:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-07  5:30 UTC (permalink / raw)
  To: Jason Xing
  Cc: ast, daniel, andrii, eddyz87, mykolal, martin.lau, song,
	yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah,
	bpf, linux-kselftest, martin.lau

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Tue,  4 Feb 2025 13:11:54 +0800 you wrote:
> 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.
> 
> Link: https://lore.kernel.org/all/6d62bd77-6733-40c7-b240-a1aeff55566c@linux.dev/
> Suggested-by: Martin KaFai Lau <martin.lau@kernel.org>
> Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
> 
> [...]

Here is the summary with links:
  - [bpf-next,v1] selftests/bpf: correct the check of join cgroup
    https://git.kernel.org/bpf/bpf-next/c/003be25ab99c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-07  5:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04  5:11 [PATCH bpf-next v1] selftests/bpf: correct the check of join cgroup Jason Xing
2025-02-05  2:42 ` Hou Tao
2025-02-07  5:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox