All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pramukh Naduthota <pnaduthota@google.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
	martin.lau@linux.dev, song@kernel.org, yhs@fb.com,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
	haoluo@google.com, jolsa@kernel.org
Subject: Re: [PATCH net-next v2 2/2] Add a selftest for devmap pinning.
Date: Tue, 6 Dec 2022 16:42:07 -0800	[thread overview]
Message-ID: <CAEeqUsrLqtxvQeKLdDe0xAc_zTM__0wuJ4Vqta+cUzQe5fuNew@mail.gmail.com> (raw)
In-Reply-To: <55bc0068-880d-4715-0fb5-a2b384951c1d@iogearbox.net>

Sorry, looks like I didn't run the tests again after fixing my
checkpatch errors. Still new to this, and am quite mortified.

Is there a better way to fix this than sending out a v3 of my patch?

On Mon, Dec 5, 2022 at 2:31 PM Daniel Borkmann <daniel@iogearbox.net> wrote:
>
> On 12/1/22 2:11 AM, Pramukh Naduthota wrote:
> > Add a selftest
> >
> > Signed-off-by: Pramukh Naduthota <pnaduthota@google.com>
> > ---
> >   .../testing/selftests/bpf/prog_tests/devmap.c | 20 +++++++++++++++++++
> >   .../selftests/bpf/progs/test_pinned_devmap.c  | 17 ++++++++++++++++
> >   2 files changed, 37 insertions(+)
> >   create mode 100644 tools/testing/selftests/bpf/prog_tests/devmap.c
> >   create mode 100644 tools/testing/selftests/bpf/progs/test_pinned_devmap.c
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/devmap.c b/tools/testing/selftests/bpf/prog_tests/devmap.c
> > new file mode 100644
> > index 000000000000..50c5006c1416
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/prog_tests/devmap.c
> > @@ -0,0 +1,20 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/* Copyright (c) 2022 Google */
> > +#include "testing_helpers.h"
> > +#include "test_progs.h"
> > +#include "test_pinned_devmap.skel.h"
> > +
> > +void test_devmap_pinning(void)
> > +{
> > +     struct test_pinned_devmap *ptr;
> > +
> > +     ptr = test_pinned_devmap__open_and_load()
> > +     ASSERT_OK_PTR(ptr, "first load");
>
> Looks like you never actually compiled your selftest? :(
>
>      [...]
>      TEST-OBJ [test_progs] rcu_read_lock.test.o
>      TEST-OBJ [test_progs] btf_dump.test.o
>    In file included from /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/devmap.c:4:
>    /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/devmap.c: In function ‘test_devmap_pinning’:
>    ./test_progs.h:352:35: error: expected expression before ‘{’ token
>      352 | #define ASSERT_OK_PTR(ptr, name) ({     \
>          |                                   ^
>    /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/devmap.c:12:2: note: in expansion of macro ‘ASSERT_OK_PTR’
>       12 |  ASSERT_OK_PTR(ptr, "first load");
>          |  ^~~~~~~~~~~~~
>    /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/devmap.c:11:8: error: called object is not a function or function pointer
>       11 |  ptr = test_pinned_devmap__open_and_load()
>          |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    make: *** [Makefile:539: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/devmap.test.o] Error 1
>    make: *** Waiting for unfinished jobs....
>    make: Leaving directory '/tmp/work/bpf/bpf/tools/testing/selftests/bpf'
>    Error: Process completed with exit code 2.
>
> > +     test_pinned_devmap__destroy(ptr);
> > +     ASSERT_OK_PTR(test_pinned_devmap__open_and_load(), "re-load");
> > +}
> > +
> > +void test_devmap(void)
> > +{
> > +     test_devmap_pinning();
> > +}
> > diff --git a/tools/testing/selftests/bpf/progs/test_pinned_devmap.c b/tools/testing/selftests/bpf/progs/test_pinned_devmap.c
> > new file mode 100644
> > index 000000000000..2e9b25fe657c
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/progs/test_pinned_devmap.c
> > @@ -0,0 +1,17 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/* Copyright (c) 2022 Google */
> > +#include <stddef.h>
> > +#include <linux/bpf.h>
> > +#include <linux/types.h>
> > +#include <bpf/bpf_helpers.h>
> > +
> > +struct {
> > +     __uint(type, BPF_MAP_TYPE_DEVMAP_HASH);
> > +     __uint(max_entries, 32);
> > +     __type(key, int);
> > +     __type(value, int);
> > +     __uint(pinning, LIBBPF_PIN_BY_NAME);
> > +} repinned_dev_map SEC(".maps");
> > +
> > +
> > +char _license[] SEC("license") = "GPL";
> >
>

  reply	other threads:[~2022-12-07  0:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01  1:11 [PATCH net-next v2 0/2] Fix pinning devmaps Pramukh Naduthota
2022-12-01  1:11 ` [PATCH net-next v2 1/2] Ignore RDONLY_PROG for devmaps in libbpf to allow re-loading of pinned devmaps Pramukh Naduthota
2022-12-01  1:11 ` [PATCH net-next v2 2/2] Add a selftest for devmap pinning Pramukh Naduthota
2022-12-05 22:31   ` Daniel Borkmann
2022-12-07  0:42     ` Pramukh Naduthota [this message]
2022-12-07  6:43       ` John Fastabend

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=CAEeqUsrLqtxvQeKLdDe0xAc_zTM__0wuJ4Vqta+cUzQe5fuNew@mail.gmail.com \
    --to=pnaduthota@google.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=song@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.