All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Carlos Neira <cneirabustos@gmail.com>
Cc: Networking <netdev@vger.kernel.org>,
	Andrii Nakryiko <andriin@fb.com>, Yonghong Song <yhs@fb.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH v10 bpf-next] bpf/selftests: fold test_current_pid_tgid_new_ns into test_progs.
Date: Tue, 22 Dec 2020 12:26:04 -0800	[thread overview]
Message-ID: <CAEf4BzbqWa+Eco4u1zN4RqyprezBAJM-O6Oq4xv9q8Ac74ZhWg@mail.gmail.com> (raw)
In-Reply-To: <20201221222315.GA19972@localhost>

On Mon, Dec 21, 2020 at 2:25 PM Carlos Neira <cneirabustos@gmail.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@gmail.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;
>

[...]

  reply	other threads:[~2020-12-22 20:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 22:23 [PATCH v10 bpf-next] bpf/selftests: fold test_current_pid_tgid_new_ns into test_progs Carlos Neira
2020-12-22 20:26 ` Andrii Nakryiko [this message]
2020-12-24 17:39   ` Carlos Antonio Neira Bustos

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=CAEf4BzbqWa+Eco4u1zN4RqyprezBAJM-O6Oq4xv9q8Ac74ZhWg@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=cneirabustos@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=netdev@vger.kernel.org \
    --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.