[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c9e51b2-5401-4d58-a319-ed620fadcc63@linux.dev>
Date: Mon, 22 Apr 2024 14:14:26 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Jordan Rife <jrife@...gle.com>
Cc: bpf@...r.kernel.org, linux-kselftest@...r.kernel.org,
netdev@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Mykola Lysenko <mykolal@...com>,
Shuah Khan <shuah@...nel.org>, Kui-Feng Lee <thinker.li@...il.com>,
Artem Savkov <asavkov@...hat.com>, Dave Marchevsky <davemarchevsky@...com>,
Menglong Dong <imagedong@...cent.com>, Daniel Xu <dxu@...uu.xyz>,
David Vernet <void@...ifault.com>, Daan De Meyer <daan.j.demeyer@...il.com>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>
Subject: Re: [PATCH v2 bpf-next 4/6] selftests/bpf: Add IPv4 and IPv6 sockaddr
test cases
On 4/18/24 9:37 AM, Jordan Rife wrote:
>> The test_sock_addr.{c,sh} can be retired as long as all its tests are migrated
>> to sock_addr.c
>
> test_sock_addr.c has a few more test dimensions than
> prog_tests/sock_addr.c currently does, so it covers a few more
> scenarios.
>
> struct sock_addr_test {
> const char *descr;
> /* BPF prog properties */
> load_fn loadfn;
> enum bpf_attach_type expected_attach_type;
> enum bpf_attach_type attach_type;
> /* Socket properties */
> int domain;
> int type;
> /* IP:port pairs for BPF prog to override */
> const char *requested_ip;
> unsigned short requested_port;
> const char *expected_ip;
> unsigned short expected_port;
> const char *expected_src_ip;
> /* Expected test result */
> enum {
> LOAD_REJECT,
> ATTACH_REJECT,
> ATTACH_OKAY,
> SYSCALL_EPERM,
> SYSCALL_ENOTSUPP,
> SUCCESS,
> } expected_result;
> };
>
> We focus on the "happy path" scenarios currently in
> prog_tests/sock_addr.c while test_sock_addr.c has test cases that
> cover a range of scenarios where loading or attaching a BPF program
> should fail. There are also a few asm tests that use program loader
> functions like sendmsg4_rw_asm_prog_load which specifies a series of
> BPF instructions directly rather than loading one of the skeletons.
> Adding in these test dimensions and migrating the test cases is a
> slightly bigger lift for this patch series. Do we want to try to
> migrate all of these to prog_tests/sock_addr.c in order to fully
> retire it?
I don't want to keep this set hostage too much until everything is migrated from
test_sock_addr.c. As long as for the tests you find useful in test_sock_addr.c
in this patch set and moved them to prog_tests/sock_addr.c, it is heading in the
right direction. For the moved test, please remove them from test_sock_addr.c so
that it is clear what else needs to be done.
[ Side note for future migration attempt, at least for the LOAD_REJECT one, it
probably makes sense to write it like progs/verifier_*.c ]
Powered by blists - more mailing lists