selftests/bpf: Remove redundant checks in get_stack_print_output()
Subsystems (5)
PATCH 1/1 selftests/bpf: Remove redundant checks in get_stack_print_output()
The checks preceding CHECK macro are redundant, remove them.
Signed-off-by Yuntao Wang <[email protected]>
--- tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c +2 -4
@@ -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 )
Signature · 1 line
2.35.1
Quoted 13 lines · Yuntao Wang
The checks preceding CHECK macro are redundant, remove them.
Signed-off-by Yuntao Wang <[email protected]>--- tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c +0
-0
tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c static void get_stack_print_output(void *ctx, int cpu, void *data, __u32 size) · line 80
Quoted 9 lines
tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c +2
-4@@ -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.
Quoted 6 lines
tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c +0
-1}void test_get_stack_raw_tp (void ) --2.35.1