From: Jiri Olsa <jolsa@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andriin@fb.com>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Alan Maguire <alan.maguire@oracle.com>
Subject: Re: [PATCHv3 bpf-next 5/7] selftests/bpf: Add test for bpf_get_func_ip helper
Date: Sun, 11 Jul 2021 16:48:33 +0200 [thread overview]
Message-ID: <YOsEwcMRkUn5mdNr@krava> (raw)
In-Reply-To: <CAEf4BzZxDAQZ4Y5n8uCjvrEgmr51CY3AQ8y7zM_Hoh+7zqd6DA@mail.gmail.com>
On Wed, Jul 07, 2021 at 05:12:07PM -0700, Andrii Nakryiko wrote:
> On Wed, Jul 7, 2021 at 2:54 PM Jiri Olsa <jolsa@redhat.com> wrote:
> >
> > Adding test for bpf_get_func_ip helper for fentry, fexit,
> > kprobe, kretprobe and fmod_ret programs.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > .../bpf/prog_tests/get_func_ip_test.c | 42 +++++++++++++
> > .../selftests/bpf/progs/get_func_ip_test.c | 62 +++++++++++++++++++
> > 2 files changed, 104 insertions(+)
> > create mode 100644 tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c
> > create mode 100644 tools/testing/selftests/bpf/progs/get_func_ip_test.c
> >
>
> [...]
>
> > + ASSERT_OK(err, "test_run");
> > +
> > + result = (__u64 *)skel->bss;
> > + for (i = 0; i < sizeof(*skel->bss) / sizeof(__u64); i++) {
> > + if (!ASSERT_EQ(result[i], 1, "fentry_result"))
> > + break;
> > + }
>
> I dislike such generic loop over results. It's super error prone and
> takes the same 5 lines of code that you'd write for explicit
>
> ASSERT_EQ(testX_result, 1, "testX_result"); /* 5 times */
ok
>
> > +
> > + get_func_ip_test__detach(skel);
>
> no need to explicitly detach, __destroy does that automatically
I see, will remove that
thanks,
jirka
>
> > +
> > +cleanup:
> > + get_func_ip_test__destroy(skel);
> > +}
>
> [...]
>
next prev parent reply other threads:[~2021-07-11 14:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 21:47 [PATCHv3 bpf-next 0/7] bpf, x86: Add bpf_get_func_ip helper Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 1/7] bpf, x86: Store caller's ip in trampoline stack Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 2/7] bpf: Enable BPF_TRAMP_F_IP_ARG for trampolines with call_get_func_ip Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 3/7] bpf: Add bpf_get_func_ip helper for tracing programs Jiri Olsa
2021-07-08 0:06 ` Andrii Nakryiko
2021-07-11 14:48 ` Jiri Olsa
2021-07-08 2:11 ` Alexei Starovoitov
2021-07-11 14:48 ` Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 4/7] bpf: Add bpf_get_func_ip helper for kprobe programs Jiri Olsa
2021-07-10 7:55 ` Masami Hiramatsu
2021-07-11 14:48 ` Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 5/7] selftests/bpf: Add test for bpf_get_func_ip helper Jiri Olsa
2021-07-08 0:12 ` Andrii Nakryiko
2021-07-11 14:48 ` Jiri Olsa [this message]
2021-07-07 21:47 ` [PATCHv3 bpf-next 6/7] libbpf: allow specification of "kprobe/function+offset" Jiri Olsa
2021-07-08 0:14 ` Andrii Nakryiko
2021-07-11 14:48 ` Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 7/7] selftests/bpf: Add test for bpf_get_func_ip in kprobe+offset probe Jiri Olsa
2021-07-08 0:18 ` Andrii Nakryiko
2021-07-11 14:48 ` Jiri Olsa
2021-07-12 23:32 ` Andrii Nakryiko
2021-07-13 14:15 ` Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YOsEwcMRkUn5mdNr@krava \
--to=jolsa@redhat.com \
--cc=alan.maguire@oracle.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.