[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbqWa+Eco4u1zN4RqyprezBAJM-O6Oq4xv9q8Ac74ZhWg@mail.gmail.com>
Date: Tue, 22 Dec 2020 12:26:04 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Carlos Neira <cneirabustos@...il.com>
Cc: Networking <netdev@...r.kernel.org>,
Andrii Nakryiko <andriin@...com>, Yonghong Song <yhs@...com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH v10 bpf-next] bpf/selftests: fold test_current_pid_tgid_new_ns
into test_progs.
On Mon, Dec 21, 2020 at 2:25 PM Carlos Neira <cneirabustos@...il.com> 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@...il.com>
> ---
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;
>
[...]
Powered by blists - more mailing lists