Message ID | 20220405163728.56471-1-ytcoode@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [bpf-next] selftests/bpf: Remove redundant checks in get_stack_print_output() | expand |
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 --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)
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(-)