Re: [PATCH v10 bpf-next] bpf/selftests: fold test_current_pid_tgid_new_ns into test_progs.

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

 



On Mon, Dec 21, 2020 at 2:25 PM Carlos Neira <cneirabustos@xxxxxxxxx> wrote:
>
> Currently tests for bpf_get_ns_current_pid_tgid() are outside test_progs.
> This change folds test cases into test_progs.
>
> Changes from v9:
>
>  - Added test in root namespace.
>  - Fixed changed tracepoint from sys_enter to sys_usleep.
>  - Fixed pid, tgid values were inverted.
>  - Used CLONE(2) for namespaced test, the new process pid will be 1.
>  - Used ASSERTEQ on pid/tgid validation.
>  - Added comment on CLONE(2) call
>
> Signed-off-by: Carlos Neira <cneirabustos@xxxxxxxxx>
> ---

See checkpatch.pl errors ([0]), ignore the "do not initialize globals
with zero" ones. Next time, please don't wait for me to point out
every single instance where you didn't align wrapped around
parameters.

  [0] https://patchwork.hopto.org/static/nipa/405025/11985347/checkpatch/stdout

>  tools/testing/selftests/bpf/.gitignore        |   1 -
>  tools/testing/selftests/bpf/Makefile          |   3 +-
>  .../bpf/prog_tests/ns_current_pid_tgid.c      | 149 ++++++++++------
>  .../bpf/progs/test_ns_current_pid_tgid.c      |  29 ++--
>  .../bpf/test_current_pid_tgid_new_ns.c        | 160 ------------------
>  5 files changed, 106 insertions(+), 236 deletions(-)
>  delete mode 100644 tools/testing/selftests/bpf/test_current_pid_tgid_new_ns.c
>

[...]

> -       id = (__u64) tid << 32 | pid;
> -       bss.user_pid_tgid = id;
> +cleanup:
> +        test_ns_current_pid_tgid__destroy(skel);
> +}
> +
> +static int newns_pidtgid(void *arg)

newns_pidtgid and test_ns_current_pid_tgid_global_ns look identical to
me, am I missing something on why you didn't reuse the testing logic
between the two?

> +{
> +       struct test_ns_current_pid_tgid__bss  *bss;
> +       int err = 0, duration = 0;
> +       struct test_ns_current_pid_tgid *skel;
> +       pid_t pid, tgid;
> +       struct stat st;
>

[...]



[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