From: Geliang Tang <tanggeliang@kylinos.cn>
This patch adds a new helper userspace_pm_get_addr() in mptcp_join.sh.
In it, parse the token value from the output of 'pm_nl_ctl events', then
pass it to pm_nl_ctl get_addr command. Use this helper in userspace pm
dump tests.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
tools/testing/selftests/net/mptcp/mptcp_join.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index cec4bfc5193b..0b325b5efccf 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -3373,6 +3373,18 @@ userspace_pm_dump()
ip netns exec $1 ./pm_nl_ctl dump token $tk
}
+# $1: ns ; $2: id
+userspace_pm_get_addr()
+{
+ local evts=$evts_ns1
+ local tk
+
+ [ "$1" == "$ns2" ] && evts=$evts_ns2
+ tk=$(mptcp_lib_evts_get_info token "$evts")
+
+ ip netns exec $1 ./pm_nl_ctl get $2 token $tk
+}
+
check_output()
{
local cmd="$1"
@@ -3610,6 +3622,8 @@ userspace_tests()
chk_subflows_total 2 2
chk_mptcp_info add_addr_signal 1 add_addr_accepted 1
local dump="id 10 flags signal 10.0.2.1"
+ check_output "userspace_pm_get_addr $ns1 10" \
+ "$dump" " get id 10 addr"
check_output "userspace_pm_dump $ns1" \
"$dump" " dump addrs signal"
kill_events_pids
@@ -3632,6 +3646,8 @@ userspace_tests()
chk_mptcp_info subflows 1 subflows 1
chk_subflows_total 2 2
local dump="id 20 flags subflow 10.0.3.2"
+ check_output "userspace_pm_get_addr $ns2 20" \
+ "$dump" " get id 20 addr"
check_output "userspace_pm_dump $ns2" \
"$dump" " dump addrs subflow"
kill_events_pids
--
2.40.1