diff mbox series

[bpf-next] selftests/bpf: Remove redundant checks in get_stack_print_output()

Message ID 20220405163728.56471-1-ytcoode@gmail.com (mailing list archive)
State Rejected
Delegated to: BPF
Headers show
Series [bpf-next] selftests/bpf: Remove redundant checks in get_stack_print_output() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR success PR summary

Commit Message

Yuntao Wang April 5, 2022, 4:37 p.m. UTC
The checks preceding CHECK macro are redundant, remove them.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
 tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Andrii Nakryiko April 5, 2022, 11:52 p.m. UTC | #1
On Tue, Apr 5, 2022 at 9:39 AM Yuntao Wang <ytcoode@gmail.com> wrote:
>
> The checks preceding CHECK macro are redundant, remove them.
>
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> ---
>  tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
> index 16048978a1ef..5f2ab720dabd 100644
> --- a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
> @@ -76,10 +76,8 @@ static void get_stack_print_output(void *ctx, int cpu, void *data, __u32 size)
>                         good_user_stack = true;
>         }
>
> -       if (!good_kern_stack)
> -           CHECK(!good_kern_stack, "kern_stack", "corrupted kernel stack\n");
> -       if (!good_user_stack)
> -           CHECK(!good_user_stack, "user_stack", "corrupted user stack\n");
> +       CHECK(!good_kern_stack, "kern_stack", "corrupted kernel stack\n");
> +       CHECK(!good_user_stack, "user_stack", "corrupted user stack\n");

I suspect it was to avoid super long verbose logs, as each CHECK()
emits one line into output and here we might be getting a lot of
samples. So let's keep it as is. But for the future let's try getting
rid of CHECK()s as much as possible in favor of ASSERT_xxx(). Thanks.

>  }
>
>  void test_get_stack_raw_tp(void)
> --
> 2.35.1
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
index 16048978a1ef..5f2ab720dabd 100644
--- a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
+++ b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
@@ -76,10 +76,8 @@  static void get_stack_print_output(void *ctx, int cpu, void *data, __u32 size)
 			good_user_stack = true;
 	}
 
-	if (!good_kern_stack)
-	    CHECK(!good_kern_stack, "kern_stack", "corrupted kernel stack\n");
-	if (!good_user_stack)
-	    CHECK(!good_user_stack, "user_stack", "corrupted user stack\n");
+	CHECK(!good_kern_stack, "kern_stack", "corrupted kernel stack\n");
+	CHECK(!good_user_stack, "user_stack", "corrupted user stack\n");
 }
 
 void test_get_stack_raw_tp(void)