selftests: mptcp: ip_mptcp option for more scripts
authorGeliang Tang <tanggeliang@kylinos.cn>
Fri, 5 Apr 2024 10:52:14 +0000 (12:52 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2024 10:53:21 +0000 (11:53 +0100)
This patch adds '-i' option for mptcp_sockopt.sh, pm_netlink.sh, and
simult_flows.sh, to use 'ip mptcp' command in the tests instead of
'pm_nl_ctl'. Update usage() correspondingly.

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_sockopt.sh
tools/testing/selftests/net/mptcp/pm_netlink.sh
tools/testing/selftests/net/mptcp/simult_flows.sh

index 36e81383f0e2e9dca7f86b41f9e9beb4f97fd52c..68899a303a1aef5b2264f23efa955baf8f2dc788 100755 (executable)
@@ -22,6 +22,28 @@ ns1=""
 ns2=""
 ns_sbox=""
 
+usage() {
+       echo "Usage: $0 [ -i ] [ -h ]"
+       echo -e "\t-i: use 'ip mptcp' instead of 'pm_nl_ctl'"
+       echo -e "\t-h: help"
+}
+
+while getopts "hi" option;do
+       case "$option" in
+       "h")
+               usage "$0"
+               exit ${KSFT_PASS}
+               ;;
+       "i")
+               mptcp_lib_set_ip_mptcp
+               ;;
+       "?")
+               usage "$0"
+               exit ${KSFT_FAIL}
+               ;;
+       esac
+done
+
 add_mark_rules()
 {
        local ns=$1
index b3adb39a7d3d200de485b51e36f174e29bbeb968..4859fa85d9a01e9a984d9cd183d6c9005ec180f0 100755 (executable)
 ret=0
 
 usage() {
-       echo "Usage: $0 [ -h ]"
+       echo "Usage: $0 [ -i ] [ -h ]"
+       echo -e "\t-i: use 'ip mptcp' instead of 'pm_nl_ctl'"
+       echo -e "\t-h: help"
 }
 
-optstring=h
+optstring=hi
 while getopts "$optstring" option;do
        case "$option" in
        "h")
                usage $0
                exit ${KSFT_PASS}
                ;;
+       "i")
+               mptcp_lib_set_ip_mptcp
+               ;;
        "?")
                usage $0
                exit ${KSFT_FAIL}
index 3ebb2fb12c8a069c4091e7ccec67c80804d443d8..4b14b4412166b5db79ea6be28c009b536a8136b8 100755 (executable)
@@ -27,10 +27,11 @@ capout=""
 size=0
 
 usage() {
-       echo "Usage: $0 [ -b ] [ -c ] [ -d ]"
+       echo "Usage: $0 [ -b ] [ -c ] [ -d ] [ -i]"
        echo -e "\t-b: bail out after first error, otherwise runs al testcases"
        echo -e "\t-c: capture packets for each test using tcpdump (default: no capture)"
        echo -e "\t-d: debug this script"
+       echo -e "\t-i: use 'ip mptcp' instead of 'pm_nl_ctl'"
 }
 
 # This function is used in the cleanup trap
@@ -259,7 +260,7 @@ run_test()
        fi
 }
 
-while getopts "bcdh" option;do
+while getopts "bcdhi" option;do
        case "$option" in
        "h")
                usage $0
@@ -274,6 +275,9 @@ while getopts "bcdh" option;do
        "d")
                set -x
                ;;
+       "i")
+               mptcp_lib_set_ip_mptcp
+               ;;
        "?")
                usage $0
                exit ${KSFT_FAIL}