From e2f18e0f4289f9e3526f225b776751737a16a52f Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Wed, 8 Nov 2023 22:11:54 +0800 Subject: [PATCH] selftests: mptcp: use KSFT_SKIP instead ksft_skip This patch uses the public var KSFT_SKIP in mptcp_lib.sh instead of ksft_skip, and drop every 'ksft_skip=4'. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/diag.sh | 5 ++--- .../selftests/net/mptcp/mptcp_connect.sh | 7 +++---- tools/testing/selftests/net/mptcp/mptcp_join.sh | 17 ++++++++--------- .../selftests/net/mptcp/mptcp_sockopt.sh | 10 ++++------ tools/testing/selftests/net/mptcp/pm_netlink.sh | 6 ++---- .../testing/selftests/net/mptcp/simult_flows.sh | 5 ++--- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index 6c5f84f59898c9..c114434954ae69 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -4,7 +4,6 @@ . "$(dirname "${0}")/mptcp_lib.sh" mptcp_lib_init_ns -ksft_skip=4 flush_pids() { @@ -32,12 +31,12 @@ mptcp_lib_check_mptcp ip -Version > /dev/null 2>&1 if [ $? -ne 0 ];then echo "SKIP: Could not run test without ip tool" - exit $ksft_skip + exit ${KSFT_SKIP} fi ss -h | grep -q MPTCP if [ $? -ne 0 ];then echo "SKIP: ss tool does not support MPTCP" - exit $ksft_skip + exit ${KSFT_SKIP} fi get_msk_inuse() diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh index a926493a349ee8..e41f96254f8471 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -8,7 +8,6 @@ time_start=$(date +%s) optstring="S:R:d:e:l:r:h4cm:f:tC" final_ret=0 cin_disconnect="" -ksft_skip=4 ipv6=true ethtool_random_on=true tc_delay="$((RANDOM%50))" @@ -136,7 +135,7 @@ mptcp_lib_check_kallsyms ip -Version > /dev/null 2>&1 if [ $? -ne 0 ];then echo "SKIP: Could not run test without ip tool" - exit $ksft_skip + exit ${KSFT_SKIP} fi capout=$(mktemp) @@ -145,7 +144,7 @@ cout_disconnect="$cout".disconnect trap cleanup EXIT for i in "$ns1" "$ns2" "$ns3" "$ns4";do - ip netns add $i || exit $ksft_skip + ip netns add $i || exit ${KSFT_SKIP} ip -net $i link set lo up done @@ -238,7 +237,7 @@ fi check_mptcp_disabled() { local disabled_ns="ns_disabled-$rndh" - ip netns add ${disabled_ns} || exit $ksft_skip + ip netns add ${disabled_ns} || exit ${KSFT_SKIP} # net.mptcp.enabled should be enabled by default if [ "$(ip netns exec ${disabled_ns} sysctl net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index f11d473549371c..3dfe20b00220c9 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -17,7 +17,6 @@ cinfail="" cinsent="" tmpfile="" capout="" -ksft_skip=4 ip_mptcp=0 check_invert=0 validate_checksum=false @@ -68,7 +67,7 @@ init_partial() local netns for netns in "$ns1" "$ns2"; do - ip netns add $netns || exit $ksft_skip + ip netns add $netns || exit ${KSFT_SKIP} ip -net $netns link set lo up ip netns exec $netns sysctl -q net.mptcp.enabled=1 ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true @@ -132,7 +131,7 @@ check_tools() if ! ip -Version &> /dev/null; then echo "SKIP: Could not run test without ip tool" - exit $ksft_skip + exit ${KSFT_SKIP} fi # Use the legacy version if available to support old kernel versions @@ -141,10 +140,10 @@ check_tools() ip6tables="ip6tables-legacy" elif ! iptables -V &> /dev/null; then echo "SKIP: Could not run all tests without iptables tool" - exit $ksft_skip + exit ${KSFT_SKIP} elif ! ip6tables -V &> /dev/null; then echo "SKIP: Could not run all tests without ip6tables tool" - exit $ksft_skip + exit ${KSFT_SKIP} fi } @@ -399,15 +398,15 @@ setup_fail_rules() -p tcp \ -m length --length 150:9999 \ -m statistic --mode nth --packet 1 --every 99999 \ - -j MARK --set-mark 42 || return ${ksft_skip} + -j MARK --set-mark 42 || return ${KSFT_SKIP} - tc -n $ns2 qdisc add dev ns2eth$i clsact || return ${ksft_skip} + tc -n $ns2 qdisc add dev ns2eth$i clsact || return ${KSFT_SKIP} tc -n $ns2 filter add dev ns2eth$i egress \ protocol ip prio 1000 \ handle 42 fw \ action pedit munge offset 148 u8 invert \ pipe csum tcp \ - index 100 || return ${ksft_skip} + index 100 || return ${KSFT_SKIP} } reset_with_fail() @@ -421,7 +420,7 @@ reset_with_fail() local rc=0 setup_fail_rules "${@}" || rc=$? - if [ ${rc} -eq ${ksft_skip} ]; then + if [ ${rc} -eq ${KSFT_SKIP} ]; then mark_as_skipped "unable to set the 'fail' rules" return 1 fi diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index 019d4dc91d708a..fccc5c50405029 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -3,8 +3,6 @@ . "$(dirname "${0}")/mptcp_lib.sh" -ksft_skip=4 - mptcp_lib_init_ns add_mark_rules() @@ -29,7 +27,7 @@ init() { local netns for netns in "$ns1" "$ns2" "$ns3";do - ip netns add $netns || exit $ksft_skip + ip netns add $netns || exit ${KSFT_SKIP} ip -net $netns link set lo up ip netns exec $netns sysctl -q net.mptcp.enabled=1 ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0 @@ -80,7 +78,7 @@ mptcp_lib_check_kallsyms ip -Version > /dev/null 2>&1 if [ $? -ne 0 ];then echo "SKIP: Could not run test without ip tool" - exit $ksft_skip + exit ${KSFT_SKIP} fi # Use the legacy version if available to support old kernel versions @@ -89,10 +87,10 @@ if iptables-legacy -V &> /dev/null; then ip6tables="ip6tables-legacy" elif ! iptables -V &> /dev/null; then echo "SKIP: Could not run all tests without iptables tool" - exit $ksft_skip + exit ${KSFT_SKIP} elif ! ip6tables -V &> /dev/null; then echo "SKIP: Could not run all tests without ip6tables tool" - exit $ksft_skip + exit ${KSFT_SKIP} fi check_mark() diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index 208669f474cf20..422aac2bfaf6ef 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -3,8 +3,6 @@ . "$(dirname "${0}")/mptcp_lib.sh" -ksft_skip=4 - usage() { echo "Usage: $0 [ -h ]" } @@ -37,12 +35,12 @@ mptcp_lib_check_mptcp ip -Version > /dev/null 2>&1 if [ $? -ne 0 ];then echo "SKIP: Could not run test without ip tool" - exit $ksft_skip + exit ${KSFT_SKIP} fi trap cleanup EXIT -ip netns add $ns1 || exit $ksft_skip +ip netns add $ns1 || exit ${KSFT_SKIP} ip -net $ns1 link set lo up ip netns exec $ns1 sysctl -q net.mptcp.enabled=1 diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index ad589c7699a1de..1fb2cb5d6b5ff9 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -4,7 +4,6 @@ . "$(dirname "${0}")/mptcp_lib.sh" mptcp_lib_init_ns -ksft_skip=4 bail=0 slack=50 @@ -32,7 +31,7 @@ mptcp_lib_check_mptcp ip -Version > /dev/null 2>&1 if [ $? -ne 0 ];then echo "SKIP: Could not run test without ip tool" - exit $ksft_skip + exit ${KSFT_SKIP} fi # "$ns1" ns2 ns3 @@ -54,7 +53,7 @@ setup() trap cleanup EXIT for i in "$ns1" "$ns2" "$ns3";do - ip netns add $i || exit $ksft_skip + ip netns add $i || exit ${KSFT_SKIP} ip -net $i link set lo up ip netns exec $i sysctl -q net.ipv4.conf.all.rp_filter=0 ip netns exec $i sysctl -q net.ipv4.conf.default.rp_filter=0