[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87fs1s1nl2.fsf@cloudflare.com>
Date: Mon, 30 Oct 2023 10:04:35 +0100
From: Jakub Sitnicki <jakub@...udflare.com>
To: Liu Jian <liujian56@...wei.com>
Cc: john.fastabend@...il.com, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
yonghong.song@...ux.dev, kpsingh@...nel.org, sdf@...gle.com,
haoluo@...gle.com, jolsa@...nel.org, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
dsahern@...nel.org, netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH bpf-next v7 7/7] selftests/bpf: add tests for verdict
skmsg to closed socket
On Sat, Oct 28, 2023 at 06:05 PM +08, Liu Jian wrote:
> Add four tests for verdict skmsg to closed socket in sockmap_basic.c.
>
> Signed-off-by: Liu Jian <liujian56@...wei.com>
> ---
> .../selftests/bpf/prog_tests/sockmap_basic.c | 42 +++++++++++++++----
> 1 file changed, 34 insertions(+), 8 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> index 75107762a86e..4d49129cdd6b 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
[...]
> @@ -651,15 +669,23 @@ void test_sockmap_basic(void)
> if (test__start_subtest("sockmap skb_verdict msg_f_peek"))
> test_sockmap_skb_verdict_peek();
> if (test__start_subtest("sockmap msg_verdict"))
> - test_sockmap_msg_verdict(false, false, false);
> + test_sockmap_msg_verdict(false, false, false, false);
> if (test__start_subtest("sockmap msg_verdict ingress"))
> - test_sockmap_msg_verdict(true, false, false);
> + test_sockmap_msg_verdict(true, false, false, false);
> if (test__start_subtest("sockmap msg_verdict permanent"))
> - test_sockmap_msg_verdict(false, true, false);
> + test_sockmap_msg_verdict(false, true, false, false);
> if (test__start_subtest("sockmap msg_verdict ingress permanent"))
> - test_sockmap_msg_verdict(true, true, false);
> + test_sockmap_msg_verdict(true, true, false, false);
> if (test__start_subtest("sockmap msg_verdict permanent self"))
> - test_sockmap_msg_verdict(false, true, true);
> + test_sockmap_msg_verdict(false, true, true, false);
> if (test__start_subtest("sockmap msg_verdict ingress permanent self"))
> - test_sockmap_msg_verdict(true, true, true);
> + test_sockmap_msg_verdict(true, true, true, false);
> + if (test__start_subtest("sockmap msg_verdict permanent shutdown"))
> + test_sockmap_msg_verdict(false, true, false, true);
> + if (test__start_subtest("sockmap msg_verdict ingress permanent shutdown"))
> + test_sockmap_msg_verdict(true, true, false, true);
> + if (test__start_subtest("sockmap msg_verdict shutdown"))
> + test_sockmap_msg_verdict(false, false, false, true);
> + if (test__start_subtest("sockmap msg_verdict ingress shutdown"))
> + test_sockmap_msg_verdict(true, false, false, true);
> }
I appreciate the split up of test changes into commits. Thanks.
As you see, the args for test_sockmap_msg_verdict became quite cryptic.
I think having dedicated aliases for 'true' would make it more readable:
const bool INGRESS = true;
const bool PERMANENT = true;
const bool TO_SELF = true;
const bool TARGET_SHUTDOWN = true;
Then invocations as:
test_sockmap_msg_verdict(true, false, false, true);
become:
test_sockmap_msg_verdict(INGRESS, !PERMANENT, !TO_SELF, TARGET_SHUTDOWN);
Powered by blists - more mailing lists