[PATCH v2] selftests: mptcp: always close input's FD if opened

Liu Jing posted 1 patch 2 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20240702040518.11058-1-liujing@cmss.chinamobile.com
tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v2] selftests: mptcp: always close input's FD if opened
Posted by Liu Jing 2 months, 1 week ago
in main_loop_s function, when the open(cfg_input, O_RDONLY) function is run,
the last fd is not closed if the "--cfg_repeat > 0" branch is not taken.

Fixes: 05be5e273c84("selftests: mptcp: add disconnect tests").

Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
---
Changes from v1
- add close function in main_loop_s function
---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index d2043ec3bf6d..48b7389ae75b 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -1119,7 +1119,8 @@ int main_loop_s(int listensock)
 		if (cfg_input)
 			close(fd);
 		goto again;
-	}
+	} else
+		close(fd);
 
 	return 0;
 }
-- 
2.33.0
Re: [PATCH v2] selftests: mptcp: always close input's FD if opened
Posted by Matthieu Baerts 2 months ago
Hi Liu,

On 02/07/2024 06:05, Liu Jing wrote:
> in main_loop_s function, when the open(cfg_input, O_RDONLY) function is run,

Please see my previous message: the commit description should have lines
of maximum ~72 chars.

> the last fd is not closed if the "--cfg_repeat > 0" branch is not taken.
> 
> Fixes: 05be5e273c84("selftests: mptcp: add disconnect tests").

There should be a space after the commit ID, not dot at the end, and no
blank line between git tags ("Fixes:", "Signed-off-by", etc.).

> 
> Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
> ---
> Changes from v1
> - add close function in main_loop_s function

It looks like you didn't change the code as I suggested: moving...

  if (cfg_input)
          close(fd);

before 'if (--cfg_repeat > 0)'.

Anyway, I just applied your patch in our tree (fixes for -net) with all
the modifications mentioned above. We will send it to netdev later with
other patches.

New patches for t/upstream-net and t/upstream:
- d2657c3f784a: selftests: mptcp: always close input's FD if opened
- Results: a9e719ce2340..fa4c0289d475 (export-net)
- Results: b49e920db095..dcc28bf9bc6a (export)

Tests are now in progress:

- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/fa397dbd31963500c42d31a4892e0b9c7e4c9ff9/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/ff673f57b4479a78dd9eb18af3c8c0fe73bf958b/checks

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH v2] selftests: mptcp: always close input's FD if opened
Posted by MPTCP CI 2 months, 1 week ago
Hi Liu,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/9760361156

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/cf373f748a67
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=867504


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)