[PATCH mptcp-next] Squash to "selftests: mptcp: make evts global in userspace_pm, v3"

Geliang Tang posted 1 patch 1 year, 4 months ago
Failed in applying to current master (apply log)
tools/testing/selftests/net/mptcp/userspace_pm.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
[PATCH mptcp-next] Squash to "selftests: mptcp: make evts global in userspace_pm, v3"
Posted by Geliang Tang 1 year, 4 months ago
Please update the commit log:

'''

This patch makes server_evts and client_evts global in userspace_pm.sh,
then these two variables could be used in test_announce(), test_remove()
and test_subflows(). The local variable 'evts' in these three functions
then could be dropped.

Also move local variable 'file' as a global one.

'''

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/net/mptcp/userspace_pm.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
index f21da6119ad8..009b9d466e4b 100755
--- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
+++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
@@ -17,6 +17,7 @@ LISTENER_CLOSED=16  #MPTCP_EVENT_LISTENER_CLOSED
 AF_INET=2
 AF_INET6=10
 
+file=""
 server_evts=""
 client_evts=""
 server_evts_pid=0
@@ -52,7 +53,7 @@ cleanup()
 {
 	echo "cleanup"
 
-	rm -f "$client_evts" "$server_evts" "$file"
+	rm -rf $file $client_evts $server_evts
 
 	# Terminate the MPTCP connection and related processes
 	if [ $client4_pid -ne 0 ]; then
@@ -121,8 +122,9 @@ make_file()
 
 make_connection()
 {
-	local file
-	file=$(mktemp)
+	if [ -z "$file" ]; then
+		file=$(mktemp)
+	fi
 	make_file "$file" "client"
 
 	local is_v6=$1
@@ -190,7 +192,6 @@ make_connection()
 		       sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
 	server_serverside=$(grep "type:1," "$server_evts" |
 			    sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q')
-	rm -f "$file"
 
 	if [ "$client_token" != "" ] && [ "$server_token" != "" ] && [ "$client_serverside" = 0 ] &&
 		   [ "$server_serverside" = 1 ]
-- 
2.35.3
Re: [PATCH mptcp-next] Squash to "selftests: mptcp: make evts global in userspace_pm, v3"
Posted by Paolo Abeni 1 year, 4 months ago
On Mon, 2022-11-28 at 17:00 +0800, Geliang Tang wrote:
> Please update the commit log:
> 
> '''
> 
> This patch makes server_evts and client_evts global in userspace_pm.sh,
> then these two variables could be used in test_announce(), test_remove()
> and test_subflows(). The local variable 'evts' in these three functions
> then could be dropped.
> 
> Also move local variable 'file' as a global one.
> 
> '''
> 
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
>  tools/testing/selftests/net/mptcp/userspace_pm.sh | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> index f21da6119ad8..009b9d466e4b 100755
> --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> @@ -17,6 +17,7 @@ LISTENER_CLOSED=16  #MPTCP_EVENT_LISTENER_CLOSED
>  AF_INET=2
>  AF_INET6=10
>  
> +file=""
>  server_evts=""
>  client_evts=""
>  server_evts_pid=0
> @@ -52,7 +53,7 @@ cleanup()
>  {
>  	echo "cleanup"
>  
> -	rm -f "$client_evts" "$server_evts" "$file"
> +	rm -rf $file $client_evts $server_evts
>  
>  	# Terminate the MPTCP connection and related processes
>  	if [ $client4_pid -ne 0 ]; then
> @@ -121,8 +122,9 @@ make_file()
>  
>  make_connection()
>  {
> -	local file
> -	file=$(mktemp)
> +	if [ -z "$file" ]; then
> +		file=$(mktemp)
> +	fi
>  	make_file "$file" "client"
>  
>  	local is_v6=$1
> @@ -190,7 +192,6 @@ make_connection()
>  		       sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
>  	server_serverside=$(grep "type:1," "$server_evts" |
>  			    sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q')
> -	rm -f "$file"
>  
>  	if [ "$client_token" != "" ] && [ "$server_token" != "" ] && [ "$client_serverside" = 0 ] &&
>  		   [ "$server_serverside" = 1 ]

LGTM (together with
https://patchwork.kernel.org/project/mptcp/list/?series=699400
)

Acked-by: Paolo Abeni <pabeni@redhat.com>