diff mbox series

selftests: mptcp: make sendfile selftest work

Message ID 20220728182544.4128-1-fw@strlen.de (mailing list archive)
State Superseded, archived
Headers show
Series selftests: mptcp: make sendfile selftest work | expand

Checks

Context Check Description
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
matttbe/build success Build and static analysis OK
matttbe/KVM_Validation__normal warning Unstable: 2 failed test(s): selftest_mptcp_join selftest_userspace_pm
matttbe/KVM_Validation__debug warning Unstable: 1 failed test(s): selftest_userspace_pm

Commit Message

Florian Westphal July 28, 2022, 6:25 p.m. UTC
When the selftest got added, sendfile() on mptcp sockets returned
-EOPNOTSUPP, so running 'mptcp_connect.sh -m sendfile' failed
immediately.

This is no longer the case, but the script fails anyway due to timeout.
Let the receiver know once the sender has sent all data, just like
with '-m mmap' mode.

Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

MPTCP CI July 28, 2022, 8:49 p.m. UTC | #1
Hi Florian,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
  - Unstable: 2 failed test(s): selftest_mptcp_join selftest_userspace_pm 
Mat Martineau July 28, 2022, 10:55 p.m. UTC | #2
On Thu, 28 Jul 2022, Florian Westphal wrote:

> When the selftest got added, sendfile() on mptcp sockets returned
> -EOPNOTSUPP, so running 'mptcp_connect.sh -m sendfile' failed
> immediately.
>
> This is no longer the case, but the script fails anyway due to timeout.
> Let the receiver know once the sender has sent all data, just like
> with '-m mmap' mode.
>

Hi Florian -

I could duplicate the timeout, and confirm that this patch fixes the 
behavior for 'mptcp_connect.sh -m sendfile'.

Unfortunately it breaks userspace_pm.sh, which also uses the mptcp_connect 
binary and deliberately keeps the connection open. userspace_pm.sh uses 
the '-w' flag with sendfile, though. See below.

> Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index e2ea6c126c99..6e429b88f911 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> @@ -791,6 +791,9 @@ static int copyfd_io_sendfile(int infd, int peerfd, int outfd,
> 		err = do_sendfile(infd, peerfd, size);
> 		if (err)
> 			return err;
> +

Adding

 		if (cfg_wait)
 			usleep(cfg_wait);

here (matching with what's in copyfd_io_poll()) seems to keep both 
userspace_pm.sh and 'mptcp_connect.sh -m sendfile' happy. copyfd_io_mmap() 
could probably use the usleep() call too.


Thanks,
Mat

> +		shutdown(peerfd, SHUT_WR);
> +
> 		err = do_recvfile(peerfd, outfd);
> 		*in_closed_after_out = true;
> 	}
> -- 
> 2.35.1
>
>

--
Mat Martineau
Intel
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index e2ea6c126c99..6e429b88f911 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -791,6 +791,9 @@  static int copyfd_io_sendfile(int infd, int peerfd, int outfd,
 		err = do_sendfile(infd, peerfd, size);
 		if (err)
 			return err;
+
+		shutdown(peerfd, SHUT_WR);
+
 		err = do_recvfile(peerfd, outfd);
 		*in_closed_after_out = true;
 	}