selftests: mptcp: add {get,format}_endpoint(s) helpers
authorGeliang Tang <tanggeliang@kylinos.cn>
Fri, 5 Apr 2024 10:52:09 +0000 (12:52 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2024 10:53:20 +0000 (11:53 +0100)
commit0d16ed0c2e743a721e372c64be73b828a0cf7cb9
tree527ac5814a823f1c55eb67dcd1230d0c40ede4d9
parent3188309c8ceb0611d0a6e9d1aca8464099695b8c
selftests: mptcp: add {get,format}_endpoint(s) helpers

The output formats of 'ip mptcp' commands are much different from that
of 'pm_nl_ctl' commands.

This patch adds a new helper format_endpoints() to format the outputs of
'ip mptcp' and 'pm_nl_ctl' with 'endpoints' arguments to hide these
differences.

A new helper named get_endpoint() has also been added to show a specific
endpoint identified by the given address ID, similar to mptcp_join.sh's
pm_nl_show_endpoints() helper, but showing all entries.

Use these two helpers in mptcp_join.sh and pm_netlink.sh to replace all
'pm_nl_ctl get' commands and outputs of 'pm_nl_ctl dump/get'.

Suggested-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/mptcp/mptcp_join.sh
tools/testing/selftests/net/mptcp/mptcp_lib.sh
tools/testing/selftests/net/mptcp/pm_netlink.sh