MPTCP Linux Development
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v2 3/4] selftests: mptcp: use cleanup_all_ns helper in lib.sh
Date: Thu, 23 May 2024 16:39:12 +0800	[thread overview]
Message-ID: <898c6f23907cccc2ab37147fbef5207e9bd0da1e.camel@kernel.org> (raw)
In-Reply-To: <d341c904ef486b7e0039c3812ddd659ef7791f9f.1716451525.git.tanggeliang@kylinos.cn>

On Thu, 2024-05-23 at 16:08 +0800, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> This patch uses cleanup_all_ns() helper defined in lib.sh instead of
> all mptcp_lib_ns_exit() in mptcp seltests. And drop this duplicate
> mptcp helper in mptcp_lib.sh.
> 
> In mptcp_connect.sh, drop mptcp_lib_ns_exit in check_mptcp_disabled()
> directly, this "disabled_ns" will be deleted by cleanup_all_ns() in
> cleanup(), together with "ns1 - ns4".
> 
> In mptcp_join.sh, drop mptcp_lib_ns_exit in cleanup_partial()
> directly,
> each existing namespace will delete automaticly in setup_ns(), only

Sorry, should be "automatically", CI complain about it.

-Geliang

> adding cleanup_all_ns in cleanup() is enough.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/net/mptcp/diag.sh          | 2 +-
>  tools/testing/selftests/net/mptcp/mptcp_connect.sh | 3 +--
>  tools/testing/selftests/net/mptcp/mptcp_join.sh    | 3 +--
>  tools/testing/selftests/net/mptcp/mptcp_lib.sh     | 8 --------
>  tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 2 +-
>  tools/testing/selftests/net/mptcp/pm_netlink.sh    | 2 +-
>  tools/testing/selftests/net/mptcp/simult_flows.sh  | 2 +-
>  tools/testing/selftests/net/mptcp/userspace_pm.sh  | 2 +-
>  8 files changed, 7 insertions(+), 17 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/diag.sh
> b/tools/testing/selftests/net/mptcp/diag.sh
> index eec1f04d231f..9e19e3e8d833 100755
> --- a/tools/testing/selftests/net/mptcp/diag.sh
> +++ b/tools/testing/selftests/net/mptcp/diag.sh
> @@ -33,7 +33,7 @@ cleanup()
>  {
>  	ip netns pids "${ns1}" | xargs --no-run-if-empty kill -
> SIGKILL &>/dev/null
>  
> -	mptcp_lib_ns_exit "${ns1}"
> +	cleanup_all_ns
>  }
>  
>  mptcp_lib_check_mptcp
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> index b77fb7065bfb..4e2c5dd0de3c 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> @@ -142,7 +142,7 @@ cleanup()
>  	rm -f "$sin" "$sout"
>  	rm -f "$capout"
>  
> -	mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns3}" "${ns4}"
> +	cleanup_all_ns
>  }
>  
>  mptcp_lib_check_mptcp
> @@ -271,7 +271,6 @@ check_mptcp_disabled()
>  	local err=0
>  	LC_ALL=C ip netns exec ${disabled_ns} ./mptcp_connect -p
> 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \
>  		grep -q "^socket: Protocol not available$" && err=1
> -	mptcp_lib_ns_exit "${disabled_ns}"
>  
>  	if [ ${err} -eq 0 ]; then
>  		mptcp_lib_pr_fail "New MPTCP socket cannot be
> blocked via sysctl"
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index fefa9173bdaa..87a518b8c19f 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -132,8 +132,6 @@ init_shapers()
>  cleanup_partial()
>  {
>  	rm -f "$capout"
> -
> -	mptcp_lib_ns_exit "${ns1}" "${ns2}"
>  }
>  
>  init() {
> @@ -166,6 +164,7 @@ cleanup()
>  	rm -rf $evts_ns1 $evts_ns2
>  	rm -f "$err"
>  	cleanup_partial
> +	cleanup_all_ns
>  }
>  
>  print_check()
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> index 59eb77e7813d..bd7d78e4aa83 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> @@ -424,14 +424,6 @@ mptcp_lib_ns_init() {
>  	done
>  }
>  
> -mptcp_lib_ns_exit() {
> -	local netns
> -	for netns in "${@}"; do
> -		ip netns del "${netns}"
> -		rm -f /tmp/"${netns}".{nstat,out}
> -	done
> -}
> -
>  mptcp_lib_events() {
>  	local ns="${1}"
>  	local evts="${2}"
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
> b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
> index 68899a303a1a..e1026b028739 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
> @@ -98,7 +98,7 @@ init()
>  #shellcheck disable=SC2317
>  cleanup()
>  {
> -	mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns_sbox}"
> +	cleanup_all_ns
>  	rm -f "$cin" "$cout"
>  	rm -f "$sin" "$sout"
>  }
> diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh
> b/tools/testing/selftests/net/mptcp/pm_netlink.sh
> index 2757378b1b13..5b4d83c2e280 100755
> --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh
> +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh
> @@ -36,7 +36,7 @@ err=$(mktemp)
>  cleanup()
>  {
>  	rm -f "${err}"
> -	mptcp_lib_ns_exit "${ns1}"
> +	cleanup_all_ns
>  }
>  
>  mptcp_lib_check_mptcp
> diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh
> b/tools/testing/selftests/net/mptcp/simult_flows.sh
> index d0b39c2e38a3..6eddb3bba2e8 100755
> --- a/tools/testing/selftests/net/mptcp/simult_flows.sh
> +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh
> @@ -42,7 +42,7 @@ cleanup()
>  	rm -f "$large" "$small"
>  	rm -f "$capout"
>  
> -	mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns3}"
> +	cleanup_all_ns
>  }
>  
>  mptcp_lib_check_mptcp
> diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> index 9e2981f2d7f5..0c089e7f5f0a 100755
> --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> @@ -107,7 +107,7 @@ cleanup()
>  		mptcp_lib_kill_wait $pid
>  	done
>  
> -	mptcp_lib_ns_exit "${ns1}" "${ns2}"
> +	cleanup_all_ns
>  
>  	rm -rf $file $client_evts $server_evts
>  


  reply	other threads:[~2024-05-23  8:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23  8:08 [PATCH mptcp-next v2 0/4] use helpers in lib.sh and net_helpers.sh Geliang Tang
2024-05-23  8:08 ` [PATCH mptcp-next v2 1/4] selftests: mptcp: rename ns to ns1 in diag.sh Geliang Tang
2024-05-23  9:14   ` Matthieu Baerts
2024-05-23  8:08 ` [PATCH mptcp-next v2 2/4] selftests: mptcp: use setup_ns helper in lib.sh Geliang Tang
2024-05-23  9:18   ` Matthieu Baerts
2024-05-23  9:26     ` Geliang Tang
2024-05-23  9:34       ` Matthieu Baerts
2024-05-23  8:08 ` [PATCH mptcp-next v2 3/4] selftests: mptcp: use cleanup_all_ns " Geliang Tang
2024-05-23  8:39   ` Geliang Tang [this message]
2024-05-23  9:22   ` Matthieu Baerts
2024-05-23  8:09 ` [PATCH mptcp-next v2 4/4] selftests: mptcp: use wait_local_port_listen helper Geliang Tang
2024-05-23  9:24   ` Matthieu Baerts
2024-05-23  8:58 ` [PATCH mptcp-next v2 0/4] use helpers in lib.sh and net_helpers.sh MPTCP CI
2024-05-23  9:13 ` Matthieu Baerts

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=898c6f23907cccc2ab37147fbef5207e9bd0da1e.camel@kernel.org \
    --to=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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