[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW5yKwo47uhpJVqGNvQBDw2w7adkZYfW9nk9Uk0RKRC-og@mail.gmail.com>
Date: Fri, 30 Oct 2020 15:30:18 -0700
From: Song Liu <song@...nel.org>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next 02/11] selftest/bpf: relax btf_dedup test checks
On Fri, Oct 30, 2020 at 11:45 AM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
[...]
> > > @@ -6775,10 +6774,15 @@ static void do_test_dedup(unsigned int test_num)
> > > err = -1;
> > > goto done;
> > > }
> > > - if (CHECK(memcmp((void *)test_type,
> > > - (void *)expect_type,
> > > - test_size),
> > > - "type #%d: contents differ", i)) {
> >
> > I guess test_size and expect_size are not needed anymore?
>
> hm.. they are used just one check above, still needed
Hmm... I don't know what happened to me back then.. Please ignore.
>
> >
> > > + if (CHECK(btf_kind(test_type) != btf_kind(expect_type),
> > > + "type %d kind: exp %d != got %u\n",
> > > + i, btf_kind(expect_type), btf_kind(test_type))) {
> > > + err = -1;
> > > + goto done;
> > > + }
> > > + if (CHECK(test_type->info != expect_type->info,
> > > + "type %d info: exp %d != got %u\n",
> > > + i, expect_type->info, test_type->info)) {
> >
> > btf_kind() returns part of ->info, so we only need the second check, no?
>
> technically yes, but when kind mismatches, figuring that out from raw
> info field is quite painful, so having a better, more targeted check
> is still good.
Fair enough. We can have a more clear check.
Thanks,
Song
Powered by blists - more mailing lists