[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZLw-QeXgb1HRR-b3D5NqQRs_iqOFcZmokvmf6rXTy-iw@mail.gmail.com>
Date: Tue, 5 Apr 2022 16:52:02 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Yuntao Wang <ytcoode@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Shuah Khan <shuah@...nel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Remove redundant checks in get_stack_print_output()
On Tue, Apr 5, 2022 at 9:39 AM Yuntao Wang <ytcoode@...il.com> wrote:
>
> The checks preceding CHECK macro are redundant, remove them.
>
> Signed-off-by: Yuntao Wang <ytcoode@...il.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
>
Powered by blists - more mailing lists