On 7/7/24 7:29 PM, Geliang Tang wrote:
From: Geliang Tangtanggeliang@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".