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/[email protected]

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/gv1pr10mb6563aecf8e94798a1e5b36a4e8...@gv1pr10mb6563.eurprd10.prod.outlook.com
v1 - 
https://lore.kernel.org/lkml/gv1pr10mb6563fcff1c5debe84fea985fe8...@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 <[email protected]>

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.


Reply via email to