Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Jordan Rife <jrife@google.com>
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	netdev@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
	Shuah Khan <shuah@kernel.org>,
	Kui-Feng Lee <thinker.li@gmail.com>,
	Artem Savkov <asavkov@redhat.com>,
	Dave Marchevsky <davemarchevsky@fb.com>,
	Menglong Dong <imagedong@tencent.com>, Daniel Xu <dxu@dxuuu.xyz>,
	David Vernet <void@manifault.com>,
	Daan De Meyer <daan.j.demeyer@gmail.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Subject: Re: [PATCH v2 bpf-next 4/6] selftests/bpf: Add IPv4 and IPv6 sockaddr test cases
Date: Mon, 22 Apr 2024 14:14:26 -0700	[thread overview]
Message-ID: <8c9e51b2-5401-4d58-a319-ed620fadcc63@linux.dev> (raw)
In-Reply-To: <CADKFtnQHy0MFeDNg6x2gzUJpuyaF6ELLyMg3tTxze3XV28qo7w@mail.gmail.com>

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 ]


  reply	other threads:[~2024-04-22 21:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 16:52 [PATCH v2 bpf-next 0/6] selftests/bpf: Add sockaddr tests for kernel networking Jordan Rife
2024-04-12 16:52 ` [PATCH v2 bpf-next 1/6] selftests/bpf: Fix bind program for big endian systems Jordan Rife
2024-04-13  1:01   ` Kui-Feng Lee
2024-04-13  1:19     ` Jordan Rife
     [not found]     ` <CADKFtnR4qtPV4OP_Y04+ON+bKc8uPxxLZF3cTj-0YCupD6y06A@mail.gmail.com>
2024-04-13  1:28       ` Kui-Feng Lee
2024-04-12 16:52 ` [PATCH v2 bpf-next 2/6] selftests/bpf: Implement socket kfuncs for bpf_testmod Jordan Rife
2024-04-13  1:26   ` Kui-Feng Lee
2024-04-15 15:34     ` Jordan Rife
2024-04-16  6:43   ` Martin KaFai Lau
2024-04-17 16:59     ` Jordan Rife
2024-05-01 21:54       ` Kui-Feng Lee
2024-04-12 16:52 ` [PATCH v2 bpf-next 3/6] selftests/bpf: Implement BPF programs for kernel socket operations Jordan Rife
2024-04-12 16:52 ` [PATCH v2 bpf-next 4/6] selftests/bpf: Add IPv4 and IPv6 sockaddr test cases Jordan Rife
2024-04-16  6:07   ` Martin KaFai Lau
2024-04-16  6:47   ` Martin KaFai Lau
2024-04-17 17:08     ` Jordan Rife
2024-04-18  0:49       ` Martin KaFai Lau
2024-04-18 16:37         ` Jordan Rife
2024-04-22 21:14           ` Martin KaFai Lau [this message]
2024-04-28 17:47             ` Jordan Rife
2024-04-29 17:40               ` Martin KaFai Lau
2024-04-29 21:47                 ` Jordan Rife
2024-04-12 16:52 ` [PATCH v2 bpf-next 5/6] selftests/bpf: Make sock configurable for each test case Jordan Rife
2024-04-12 16:52 ` [PATCH v2 bpf-next 6/6] selftests/bpf: Add kernel socket operation tests Jordan Rife

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c9e51b2-5401-4d58-a319-ed620fadcc63@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=asavkov@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daan.j.demeyer@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=davemarchevsky@fb.com \
    --cc=dxu@dxuuu.xyz \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=imagedong@tencent.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=jrife@google.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=thinker.li@gmail.com \
    --cc=void@manifault.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox