From: Martin KaFai Lau <martin.lau@linux.dev>
To: Geliang Tang <geliang@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Mykola Lysenko <mykolal@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
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>, Shuah Khan <shuah@kernel.org>,
Geliang Tang <tanggeliang@kylinos.cn>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next v10 07/12] selftests/bpf: Set expect_errno for cgroup_skb_sk_lookup
Date: Mon, 8 Jul 2024 14:04:39 -0700 [thread overview]
Message-ID: <c575540f-fb92-4955-bae1-30c029f49bd7@linux.dev> (raw)
In-Reply-To: <49c13acb05e74e13b1a20c8bbb89d26376ffbf11.1720405046.git.tanggeliang@kylinos.cn>
On 7/7/24 7:29 PM, Geliang Tang wrote:
> From: Geliang Tang<tanggeliang@kylinos.cn>
>
> EINPROGRESS is skipped in run_lookup_test() in cgroup_skb_sk_lookup
> tests, but it is still showed in the log:
>
> ./test_progs -t cgroup_skb_sk_lookup -v
>
> run_cgroup_bpf_test:PASS:skel_open_load 0 nsec
> run_cgroup_bpf_test:PASS:cgroup_join 0 nsec
> run_cgroup_bpf_test:PASS:cgroup_attach 0 nsec
> run_lookup_test:PASS:start_server 0 nsec
> run_lookup_test:PASS:getsockname 0 nsec
> (network_helpers.c:300: errno: Operation now in progress) Failed to \
> connect to server
This log is fine as-is and no need to "fix". The network_helpers failed in doing
some socket operations and log this fact without treating it as a test_progs
failure.
The individual test does expect this socket operation to fail, so test_progs
does not report ":FAIL" for this test. CI is also smart enough and only shows
the individual test's details log when that test ":FAIL" (i.e. the ASSERT_* failed).
> run_lookup_test:PASS:connect_fd_to_fd 0 nsec
> run_lookup_test:PASS:connect_to_fd 0 nsec
> run_lookup_test:PASS:accept 0 nsec
> #51 cgroup_skb_sk_lookup:OK
>
> To fix this, set EINPROGRESS as "expect_errno" of network_helper_opts and
> pass it to connect_fd_to_fd(). Skip this expect_errno when must_fail is
> false too in connect_fd_to_addr().
>
> connect_fd_to_fd() returns "0" when connect() fails but "expect_errno"
> matched. So "err" is "0" after invoking connect_fd_to_fd() in
> run_lookup_test(). "err = -errno" is needed to get the real error number
> before checking value of "err".
next prev parent reply other threads:[~2024-07-08 21:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 2:29 [PATCH bpf-next v10 00/12] use network helpers, part 8 Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 01/12] selftests/bpf: Add backlog for network_helper_opts Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 02/12] selftests/bpf: Use start_server_str in sockmap_ktls Geliang Tang
2024-07-08 8:46 ` Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 03/12] selftests/bpf: Use connect_to_fd_opts " Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 04/12] selftests/bpf: Use make_sockaddr " Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 05/12] selftests/bpf: Add network_helper_opts for connect_fd_to_fd Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 06/12] selftests/bpf: Add expect_errno for network_helper_opts Geliang Tang
2024-07-08 19:15 ` Eduard Zingerman
2024-07-08 20:06 ` Martin KaFai Lau
2024-07-08 2:29 ` [PATCH bpf-next v10 07/12] selftests/bpf: Set expect_errno for cgroup_skb_sk_lookup Geliang Tang
2024-07-08 21:04 ` Martin KaFai Lau [this message]
2024-07-08 2:29 ` [PATCH bpf-next v10 08/12] selftests/bpf: Close fd in error path in drop_on_reuseport Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 09/12] selftests/bpf: Use start_server_str in sk_lookup Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 10/12] selftests/bpf: Use connect_fd_to_fd " Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 11/12] selftests/bpf: Use connect_to_addr " Geliang Tang
2024-07-08 2:29 ` [PATCH bpf-next v10 12/12] selftests/bpf: Drop make_socket " Geliang Tang
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=c575540f-fb92-4955-bae1-30c029f49bd7@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=geliang@kernel.org \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mykolal@fb.com \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=tanggeliang@kylinos.cn \
--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