[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW7y3ycWkXLwSmJ5TKbo7Syd65aLRABtWbZcohET0RF6rA@mail.gmail.com>
Date: Thu, 7 Oct 2021 13:33:49 -0700
From: Song Liu <song@...nel.org>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next v1 4/6] bpf: selftests: Move test_ksyms_weak test
to lskel, add libbpf test
On Tue, Oct 5, 2021 at 5:29 PM Kumar Kartikeya Dwivedi <memxor@...il.com> wrote:
>
> Also, avoid using CO-RE features, as lskel doesn't support CO-RE, yet.
> Create a file for testing libbpf skeleton as well, so that both
> gen_loader and libbpf get tested.
>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@...il.com>
[...]
> diff --git a/tools/testing/selftests/bpf/prog_tests/ksyms_weak_libbpf.c b/tools/testing/selftests/bpf/prog_tests/ksyms_weak_libbpf.c
> new file mode 100644
> index 000000000000..b75725e28647
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/ksyms_weak_libbpf.c
> @@ -0,0 +1,31 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <test_progs.h>
> +#include "test_ksyms_weak.skel.h"
> +
> +void test_ksyms_weak_libbpf(void)
This is (almost?) the same as test_weak_syms(), right? Why do we need both?
> +{
> + struct test_ksyms_weak *skel;
> + struct test_ksyms_weak__data *data;
> + int err;
> +
> + skel = test_ksyms_weak__open_and_load();
> + if (!ASSERT_OK_PTR(skel, "test_ksyms_weak__open_and_load"))
> + return;
[...]
> diff --git a/tools/testing/selftests/bpf/progs/test_ksyms_weak.c b/tools/testing/selftests/bpf/progs/test_ksyms_weak.c
> index 5f8379aadb29..521e7b99db08 100644
> --- a/tools/testing/selftests/bpf/progs/test_ksyms_weak.c
> +++ b/tools/testing/selftests/bpf/progs/test_ksyms_weak.c
> @@ -21,7 +21,6 @@ __u64 out__non_existent_typed = -1;
> extern const struct rq runqueues __ksym __weak; /* typed */
> extern const void bpf_prog_active __ksym __weak; /* typeless */
>
> -
> /* non-existent weak symbols. */
>
> /* typeless symbols, default to zero. */
> @@ -38,7 +37,7 @@ int pass_handler(const void *ctx)
> /* tests existing symbols. */
> rq = (struct rq *)bpf_per_cpu_ptr(&runqueues, 0);
> if (rq)
> - out__existing_typed = rq->cpu;
> + out__existing_typed = 0;
Why do we need this change?
> out__existing_typeless = (__u64)&bpf_prog_active;
>
> /* tests non-existent symbols. */
> --
> 2.33.0
>
Powered by blists - more mailing lists