Skip to contentSkip to conversation

Squash to "selftests: mptcp: make evts global in userspace_pm, v3"

PATCH In review Geliang Tang 2 participants 2 messages Nov 28, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Squash to "selftests: mptcp: make evts global in userspace_pm, v3"

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.

'''

---
 tools/testing/selftests/net/mptcp/userspace_pm.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/userspace_pm.sh +5 -4
index f21da6119ad8..009b9d466e4b 100755
@@ -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 ]
Signature · 1 line
2.35.3
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 53 lines · Geliang Tang

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.

'''

---
 tools/testing/selftests/net/mptcp/userspace_pm.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/userspace_pm.sh +5 -3
index f21da6119ad8..009b9d466e4b 100755
@@ -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

tools/testing/selftests/net/mptcp/userspace_pm.sh make_connection() · line 197

Quoted 7 lines
tools/testing/selftests/net/mptcp/userspace_pm.sh +0 -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
)