.../selftests/bpf/prog_tests/bind_perm.c | 6 +- .../selftests/bpf/prog_tests/bpf_obj_id.c | 204 +++++++----------- .../selftests/bpf/prog_tests/bpf_tcp_ca.c | 48 ++--- .../selftests/bpf/prog_tests/vmlinux.c | 16 +- 4 files changed, 105 insertions(+), 169 deletions(-)
Multiple files/programs in `tools/testing/selftests/bpf/prog_tests/` still
heavily use the `CHECK` macro, even when better `ASSERT_` alternatives are
available.
As it was already pointed out by Yonghong Song [1] in the bpf selftests the use
of the ASSERT_* series of macros is preferred over the CHECK macro.
This patchset replaces the usage of `CHECK(` macros to the equivalent `ASSERT_`
family of macros in the following prog_tests:
- bind_perm.c
- bpf_obj_id.c
- bpf_tcp_ca.c
- vmlinux.c
[1] https://lore.kernel.org/lkml/0a142924-633c-44e6-9a92-2dc019656bf2@linux.dev
Changes in v3:
- Addressed the following points mentioned by Yonghong Song
- Improved `bpf_map_lookup_elem` assertion in bpf_tcp_ca.
- Replaced assertion introduced in v2 with one that checks `thread_ret`
instead of `pthread_join`. This ensures that `server`'s return value
(thread_ret) is the one being checked, as oposed to `pthread_join`'s
return value, since the latter one is less likely to fail.
Changes in v2:
- Fixed pthread_join assertion that broke the previous test
Previous version:
v2 - https://lore.kernel.org/lkml/GV1PR10MB6563AECF8E94798A1E5B36A4E8B6A@GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM
v1 - https://lore.kernel.org/lkml/GV1PR10MB6563FCFF1C5DEBE84FEA985FE8B0A@GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM
Yuran Pereira (4):
Replaces the usage of CHECK calls for ASSERTs in bpf_tcp_ca
Replaces the usage of CHECK calls for ASSERTs in bind_perm
Replaces the usage of CHECK calls for ASSERTs in bpf_obj_id
selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in
vmlinux
.../selftests/bpf/prog_tests/bind_perm.c | 6 +-
.../selftests/bpf/prog_tests/bpf_obj_id.c | 204 +++++++-----------
.../selftests/bpf/prog_tests/bpf_tcp_ca.c | 48 ++---
.../selftests/bpf/prog_tests/vmlinux.c | 16 +-
4 files changed, 105 insertions(+), 169 deletions(-)
--
2.25.1
Hello:
This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 21 Nov 2023 05:33:14 +0530 you wrote:
> Multiple files/programs in `tools/testing/selftests/bpf/prog_tests/` still
> heavily use the `CHECK` macro, even when better `ASSERT_` alternatives are
> available.
>
> As it was already pointed out by Yonghong Song [1] in the bpf selftests the use
> of the ASSERT_* series of macros is preferred over the CHECK macro.
>
> [...]
Here is the summary with links:
- [bpf-next,v3,1/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in bpf_tcp_ca
https://git.kernel.org/bpf/bpf-next/c/b0e2a0395312
- [bpf-next,v3,2/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in bind_perm
https://git.kernel.org/bpf/bpf-next/c/3ec1114a9745
- [bpf-next,v3,3/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in bpf_obj_id
https://git.kernel.org/bpf/bpf-next/c/f125d09b99fc
- [bpf-next,v3,4/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in vmlinux
https://git.kernel.org/bpf/bpf-next/c/3ece0e85f679
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
On 11/20/23 7:03 PM, Yuran Pereira wrote: > Multiple files/programs in `tools/testing/selftests/bpf/prog_tests/` still > heavily use the `CHECK` macro, even when better `ASSERT_` alternatives are > available. > > As it was already pointed out by Yonghong Song [1] in the bpf selftests the use > of the ASSERT_* series of macros is preferred over the CHECK macro. > > This patchset replaces the usage of `CHECK(` macros to the equivalent `ASSERT_` > family of macros in the following prog_tests: > - bind_perm.c > - bpf_obj_id.c > - bpf_tcp_ca.c > - vmlinux.c > > [1] https://lore.kernel.org/lkml/0a142924-633c-44e6-9a92-2dc019656bf2@linux.dev > > Changes in v3: > - Addressed the following points mentioned by Yonghong Song > - Improved `bpf_map_lookup_elem` assertion in bpf_tcp_ca. > - Replaced assertion introduced in v2 with one that checks `thread_ret` > instead of `pthread_join`. This ensures that `server`'s return value > (thread_ret) is the one being checked, as oposed to `pthread_join`'s > return value, since the latter one is less likely to fail. > > Changes in v2: > - Fixed pthread_join assertion that broke the previous test > > Previous version: > v2 - https://lore.kernel.org/lkml/GV1PR10MB6563AECF8E94798A1E5B36A4E8B6A@GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM > v1 - https://lore.kernel.org/lkml/GV1PR10MB6563FCFF1C5DEBE84FEA985FE8B0A@GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM > > Yuran Pereira (4): > Replaces the usage of CHECK calls for ASSERTs in bpf_tcp_ca > Replaces the usage of CHECK calls for ASSERTs in bind_perm > Replaces the usage of CHECK calls for ASSERTs in bpf_obj_id > selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in > vmlinux > > .../selftests/bpf/prog_tests/bind_perm.c | 6 +- > .../selftests/bpf/prog_tests/bpf_obj_id.c | 204 +++++++----------- > .../selftests/bpf/prog_tests/bpf_tcp_ca.c | 48 ++--- > .../selftests/bpf/prog_tests/vmlinux.c | 16 +- > 4 files changed, 105 insertions(+), 169 deletions(-) > Ack for the whole series: Acked-by: Yonghong Song <yonghong.song@linux.dev> Yuran, next time when you submit patches, you can carry 'Acked-by' tag from previous revision if there are no significant changes. This will reduce some of reviewers and maintainers' work.
On Mon, Nov 20, 2023 at 10:49:39PM -0800, Yonghong Song wrote: > Yuran, next time when you submit patches, you can carry 'Acked-by' tag > from previous revision if there are no significant changes. This will > reduce some of reviewers and maintainers' work. > Alright, I will keep that in mind in the future. Thanks, Yuran Pereira
© 2016 - 2025 Red Hat, Inc.