Re: [PATCH v14 4/5] tools/testing/selftests/bpf: Add self-tests for new helper.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 19, 2019 at 1:58 AM Yonghong Song <yhs@xxxxxx> wrote:
>
>
>
> On 10/17/19 8:00 AM, Carlos Neira wrote:
> > Self tests added for new helper
> >
> > Signed-off-by: Carlos Neira <cneirabustos@xxxxxxxxx>
> > ---
> >   .../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;
>

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux