selftests/bpf: correct the check of join cgroup
Subsystems (3)
PATCH 1/1 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.
--- tools/testing/selftests/bpf/prog_tests/setget_sockopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/setget_sockopt.c +1 -1
@@ -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 ())
Signature · 1 line
2.43.5
Quoted 7 lines · Jason Xing
Use
ASSERT_OK_FDto check the return value of join cgroup, or else this test will pass even if the fd < 0.ASSERT_OK_FDcan print the error message to the console.Suggested-by Martin KaFai Lau <[email protected]>Signed-off-by Jason Xing <[email protected]>
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Quoted 9 lines · On Tue, 4 Feb 2025 13:11:54 +0800 you wrote:
Use
ASSERT_OK_FDto check the return value of join cgroup, or else this test will pass even if the fd < 0.ASSERT_OK_FDcan print the error message to the console.Suggested-by Martin KaFai Lau <[email protected]>Signed-off-by Jason Xing <[email protected]>[...]
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html