diff mbox series

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

Message ID 20240702040518.11058-1-liujing@cmss.chinamobile.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v2] selftests: mptcp: always close input's FD if opened | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 2
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning CHECK: Unbalanced braces around else statement WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: d3b29abac236 ("selftests: mptcp: always close input's FD if opened")'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-07-02--21-00 (tests: 664)

Commit Message

Liu Jing July 2, 2024, 4:05 a.m. UTC
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(-)

Comments

Matthieu Baerts July 3, 2024, 5:40 p.m. UTC | #1
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
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 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;
 }