selftests: mptcp: add tc check for check_tools
authorGeliang Tang <tanggeliang@kylinos.cn>
Fri, 5 Apr 2024 10:52:05 +0000 (12:52 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2024 10:53:20 +0000 (11:53 +0100)
tc are used in some test scripts: mptcp_connect.sh, mptcp_join.sh and
simult_flows.sh. It makes sense to check if tc is installed before running
these scripts, just like other tools. So this patch add 'tc' check for
mptcp_lib_check_tools(), and check it in these test 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>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/mptcp/mptcp_connect.sh
tools/testing/selftests/net/mptcp/mptcp_join.sh
tools/testing/selftests/net/mptcp/mptcp_lib.sh
tools/testing/selftests/net/mptcp/simult_flows.sh

index 4131f3263a4826b808fca43ab92be4b893bb8522..b77fb7065bfb8c747b4826e961c6a179aec7a996 100755 (executable)
@@ -147,7 +147,7 @@ cleanup()
 
 mptcp_lib_check_mptcp
 mptcp_lib_check_kallsyms
-mptcp_lib_check_tools ip
+mptcp_lib_check_tools ip tc
 
 sin=$(mktemp)
 sout=$(mktemp)
index e4403236f655488e298c86d51fef70a07d602384..5a95798eb40a1f47643828eaa71226e1632d8cdd 100755 (executable)
@@ -142,7 +142,7 @@ init() {
 
        mptcp_lib_check_mptcp
        mptcp_lib_check_kallsyms
-       mptcp_lib_check_tools ip ss "${iptables}" "${ip6tables}"
+       mptcp_lib_check_tools ip tc ss "${iptables}" "${ip6tables}"
 
        sin=$(mktemp)
        sout=$(mktemp)
index d529b4b37af86954c90699e1b5e0cb376c147d8c..1fa05405f65ea0f20a20c9ac27de593eaf15e879 100644 (file)
@@ -384,6 +384,12 @@ mptcp_lib_check_tools() {
                                exit ${KSFT_SKIP}
                        fi
                        ;;
+               "tc")
+                       if ! tc -help &> /dev/null; then
+                               mptcp_lib_pr_skip "Could not run test without tc tool"
+                               exit ${KSFT_SKIP}
+                       fi
+                       ;;
                "ss")
                        if ! ss -h | grep -q MPTCP; then
                                mptcp_lib_pr_skip "ss tool does not support MPTCP"
index 1b23662203881f65947eec4dedcce3e8763554f7..497141c49ccd4f1e710f40ff4bd6901356a806af 100755 (executable)
@@ -45,7 +45,7 @@ cleanup()
 }
 
 mptcp_lib_check_mptcp
-mptcp_lib_check_tools ip
+mptcp_lib_check_tools ip tc
 
 #  "$ns1"              ns2                    ns3
 #     ns1eth1    ns2eth1   ns2eth3      ns3eth1