[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbsDbxjALMJ119B-nweD1xEZ_PHX9r9k8qDpekraaHR2w@mail.gmail.com>
Date: Mon, 21 Oct 2019 11:20:01 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Yonghong Song <yhs@...com>
Cc: Carlos Neira <cneirabustos@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"ebiederm@...ssion.com" <ebiederm@...ssion.com>,
"brouer@...hat.com" <brouer@...hat.com>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>
Subject: Re: [PATCH v14 4/5] tools/testing/selftests/bpf: Add self-tests for
new helper.
On Sat, Oct 19, 2019 at 1:58 AM Yonghong Song <yhs@...com> wrote:
>
>
>
> On 10/17/19 8:00 AM, Carlos Neira wrote:
> > Self tests added for new helper
> >
> > Signed-off-by: Carlos Neira <cneirabustos@...il.com>
> > ---
> > .../bpf/prog_tests/get_ns_current_pid_tgid.c | 96 +++++++++++++++++++
> > .../bpf/progs/get_ns_current_pid_tgid_kern.c | 53 ++++++++++
It looks like typical naming convention is:
prog_test/<something>.c
progs/test_<something>.c
Let's keep this consistent. I'm about to do a bit smarter Makefile
that will capture this convention, so it's good to have less exception
to create. Thanks!
Otherwise, besides what Yonghong mentioned, this look good to me.
> > 2 files changed, 149 insertions(+)
> > create mode 100644 tools/testing/selftests/bpf/prog_tests/get_ns_current_pid_tgid.c
> > create mode 100644 tools/testing/selftests/bpf/progs/get_ns_current_pid_tgid_kern.c
> >
[...]
> > + prog = bpf_object__find_program_by_title(obj, probe_name);
> > + if (CHECK(!prog, "find_probe",
> > + "prog '%s' not found\n", probe_name))
> > + goto cleanup;
> > +
> > + bpf_program__set_type(prog, BPF_PROG_TYPE_RAW_TRACEPOINT);
>
> Do we need this? I thought libbpf should automatically
> infer program type from section name?
We used to, until the patch set that Daniel landed today. Now it can be dropped.
>
> > +
> > + load_attr.obj = obj;
> > + load_attr.log_level = 0;
> > + load_attr.target_btf_path = NULL;
> > + err = bpf_object__load_xattr(&load_attr);
> > + if (CHECK(err, "obj_load",
> > + "failed to load prog '%s': %d\n",
> > + probe_name, err))
> > + goto cleanup;
>
[...]
Powered by blists - more mailing lists