[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yoi3QLuCD5Q5iG46@lore-desk>
Date: Sat, 21 May 2022 11:56:16 +0200
From: Lorenzo Bianconi <lorenzo@...nel.org>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, pabeni@...hat.com,
Pablo Neira Ayuso <pablo@...filter.org>,
Florian Westphal <fw@...len.de>,
netfilter-devel@...r.kernel.org,
Lorenzo Bianconi <lorenzo.bianconi@...hat.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Kumar Kartikeya Dwivedi <memxor@...il.com>
Subject: Re: [PATCH v3 bpf-next 5/5] selftests/bpf: add selftest for
bpf_xdp_ct_add and bpf_ct_refresh_timeout kfunc
> On Wed, May 18, 2022 at 3:44 AM Lorenzo Bianconi <lorenzo@...nel.org> wrote:
> >
> > Introduce selftests for the following kfunc helpers:
> > - bpf_xdp_ct_add
> > - bpf_skb_ct_add
> > - bpf_ct_refresh_timeout
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> > ---
> > .../testing/selftests/bpf/prog_tests/bpf_nf.c | 4 ++
> > .../testing/selftests/bpf/progs/test_bpf_nf.c | 72 +++++++++++++++----
> > 2 files changed, 64 insertions(+), 12 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_nf.c b/tools/testing/selftests/bpf/prog_tests/bpf_nf.c
> > index dd30b1e3a67c..be6c5650892f 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/bpf_nf.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/bpf_nf.c
> > @@ -39,6 +39,10 @@ void test_bpf_nf_ct(int mode)
> > ASSERT_EQ(skel->bss->test_enonet_netns_id, -ENONET, "Test ENONET for bad but valid netns_id");
> > ASSERT_EQ(skel->bss->test_enoent_lookup, -ENOENT, "Test ENOENT for failed lookup");
> > ASSERT_EQ(skel->bss->test_eafnosupport, -EAFNOSUPPORT, "Test EAFNOSUPPORT for invalid len__tuple");
> > + ASSERT_EQ(skel->bss->test_add_entry, 0, "Test for adding new entry");
> > + ASSERT_EQ(skel->bss->test_succ_lookup, 0, "Test for successful lookup");
> > + ASSERT_TRUE(skel->bss->test_delta_timeout > 9 && skel->bss->test_delta_timeout <= 10,
> > + "Test for ct timeout update");
>
> if/when this fails we'll have "true != false" message not knowing what
> was the actual value of skel->bss->test_delta_timeout.
>
> This is equivalent to a much better:
>
> ASSERT_GT(skel->bss->test_delta_timeout, 9, "ct_timeout1");
> ASSERT_LE(skel->bss->test_delta_timeout, 10, "ct_timeout2");
ack, I will fix it in the next version.
Regards,
Lorenzo
>
> > end:
> > test_bpf_nf__destroy(skel);
> > }
>
>
> [...]
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists