Skip to content

Commit

Permalink
selftests: mptcp: use KSFT_SKIP instead ksft_skip
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
geliangtang authored and intel-lab-lkp committed Nov 8, 2023
1 parent 738e6c4 commit e2f18e0
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 29 deletions.
5 changes: 2 additions & 3 deletions tools/testing/selftests/net/mptcp/diag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
. "$(dirname "${0}")/mptcp_lib.sh"

mptcp_lib_init_ns
ksft_skip=4

flush_pids()
{
Expand Down Expand Up @@ -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()
Expand Down
7 changes: 3 additions & 4 deletions tools/testing/selftests/net/mptcp/mptcp_connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
17 changes: 8 additions & 9 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ cinfail=""
cinsent=""
tmpfile=""
capout=""
ksft_skip=4
ip_mptcp=0
check_invert=0
validate_checksum=false
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
10 changes: 4 additions & 6 deletions tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

. "$(dirname "${0}")/mptcp_lib.sh"

ksft_skip=4

mptcp_lib_init_ns

add_mark_rules()
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
6 changes: 2 additions & 4 deletions tools/testing/selftests/net/mptcp/pm_netlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

. "$(dirname "${0}")/mptcp_lib.sh"

ksft_skip=4

usage() {
echo "Usage: $0 [ -h ]"
}
Expand Down Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions tools/testing/selftests/net/mptcp/simult_flows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
. "$(dirname "${0}")/mptcp_lib.sh"

mptcp_lib_init_ns
ksft_skip=4
bail=0
slack=50

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e2f18e0

Please sign in to comment.