summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/mptcp/mptcp_join.sh
diff options
context:
space:
mode:
authorGeliang Tang <tanggeliang@kylinos.cn>2024-03-06 12:42:51 +0300
committerJakub Kicinski <kuba@kernel.org>2024-03-08 08:06:51 +0300
commit3fb8c33ef4b90f4cc83e635ca716a831d5251bc7 (patch)
tree908a447898426b478bb7f6ad5a3e7ab39848fe9c /tools/testing/selftests/net/mptcp/mptcp_join.sh
parent7c2eac649054c04007f61fcc90a42f6800727efc (diff)
downloadlinux-3fb8c33ef4b90f4cc83e635ca716a831d5251bc7.tar.xz
selftests: mptcp: add mptcp_lib_check_tools helper
This patch exports check_tools() helper from mptcp_join.sh into mptcp_lib.sh as a public one mptcp_lib_check_tools(). The arguments "ip", "ss", "iptables" and "ip6tables" are passed into this helper to indicate whether to check ip tool, ss tool, iptables and ip6tables tools. This helper can be used in every scripts. 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> Link: https://lore.kernel.org/r/20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-2-bc79e6e5e6a0@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/mptcp/mptcp_join.sh')
-rwxr-xr-xtools/testing/selftests/net/mptcp/mptcp_join.sh28
1 files changed, 3 insertions, 25 deletions
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 6a4af95cd4c3..aedc5698f26a 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -152,34 +152,12 @@ cleanup_partial()
done
}
-check_tools()
-{
- mptcp_lib_check_mptcp
- mptcp_lib_check_kallsyms
-
- if ! ip -Version &> /dev/null; then
- echo "SKIP: Could not run test without ip tool"
- exit $ksft_skip
- fi
-
- if ! ss -h | grep -q MPTCP; then
- echo "SKIP: ss tool does not support MPTCP"
- exit $ksft_skip
- fi
-
- if ! "${iptables}" -V &> /dev/null; then
- echo "SKIP: Could not run all tests without ${iptables} tool"
- exit $ksft_skip
- elif ! "${ip6tables}" -V &> /dev/null; then
- echo "SKIP: Could not run all tests without ${ip6tables} tool"
- exit $ksft_skip
- fi
-}
-
init() {
init=1
- check_tools
+ mptcp_lib_check_mptcp
+ mptcp_lib_check_kallsyms
+ mptcp_lib_check_tools ip ss "${iptables}" "${ip6tables}"
sin=$(mktemp)
sout=$(mktemp)