Message ID | 20210524065844.19788-2-po-hsu.lin@canonical.com |
---|---|
State | New |
Headers | show |
Series | Improve the test result processing for kselftests/net/pmtu.sh | expand |
On 24.05.21 08:58, Po-Hsu Lin wrote: > BugLink: https://bugs.launchpad.net/bugs/1887661 > > This test uses return code 2 as a hard-coded skipped state, let's use > the kselftest framework skip code variable $ksft_skip instead to make > it more readable and easier to maintain. > > Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com> > Signed-off-by: Jakub Kicinski <kuba@kernel.org> > (backported from commit ef1220a7d4bbdb5fc435d691776778568dfb69a8) > [PHLin: ignore changes for the test cases that do not exist yet] > Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com> Applied to focal:linux. Thanks, Kleber > --- > tools/testing/selftests/net/pmtu.sh | 48 ++++++++++++++++++------------------- > 1 file changed, 24 insertions(+), 24 deletions(-) > > diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh > index 3429767..0ae9c19 100755 > --- a/tools/testing/selftests/net/pmtu.sh > +++ b/tools/testing/selftests/net/pmtu.sh > @@ -298,7 +298,7 @@ setup_fou_or_gue() { > encap="${3}" > > if [ "${outer}" = "4" ]; then > - modprobe fou || return 2 > + modprobe fou || return $ksft_skip > a_addr="${prefix4}.${a_r1}.1" > b_addr="${prefix4}.${b_r1}.1" > if [ "${inner}" = "4" ]; then > @@ -309,7 +309,7 @@ setup_fou_or_gue() { > ipproto="41" > fi > else > - modprobe fou6 || return 2 > + modprobe fou6 || return $ksft_skip > a_addr="${prefix6}:${a_r1}::1" > b_addr="${prefix6}:${b_r1}::1" > if [ "${inner}" = "4" ]; then > @@ -323,8 +323,8 @@ setup_fou_or_gue() { > fi > fi > > - run_cmd ${ns_a} ip fou add port 5555 ipproto ${ipproto} || return 2 > - run_cmd ${ns_a} ip link add ${encap}_a type ${type} ${mode} local ${a_addr} remote ${b_addr} encap ${encap} encap-sport auto encap-dport 5556 || return 2 > + run_cmd ${ns_a} ip fou add port 5555 ipproto ${ipproto} || return $ksft_skip > + run_cmd ${ns_a} ip link add ${encap}_a type ${type} ${mode} local ${a_addr} remote ${b_addr} encap ${encap} encap-sport auto encap-dport 5556 || return $ksft_skip > > run_cmd ${ns_b} ip fou add port 5556 ipproto ${ipproto} > run_cmd ${ns_b} ip link add ${encap}_b type ${type} ${mode} local ${b_addr} remote ${a_addr} encap ${encap} encap-sport auto encap-dport 5555 > @@ -672,7 +672,7 @@ check_pmtu_value() { > test_pmtu_ipvX() { > family=${1} > > - setup namespaces routing || return 2 > + setup namespaces routing || return $ksft_skip > trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ > "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ > "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ > @@ -770,11 +770,11 @@ test_pmtu_ipvX_over_vxlanY_or_geneveY_exception() { > ll_mtu=4000 > > if [ ${outer_family} -eq 4 ]; then > - setup namespaces routing ${type}4 || return 2 > + setup namespaces routing ${type}4 || return $ksft_skip > # IPv4 header UDP header VXLAN/GENEVE header Ethernet header > exp_mtu=$((${ll_mtu} - 20 - 8 - 8 - 14)) > else > - setup namespaces routing ${type}6 || return 2 > + setup namespaces routing ${type}6 || return $ksft_skip > # IPv6 header UDP header VXLAN/GENEVE header Ethernet header > exp_mtu=$((${ll_mtu} - 40 - 8 - 8 - 14)) > fi > @@ -844,7 +844,7 @@ test_pmtu_ipvX_over_fouY_or_gueY() { > encap=${3} > ll_mtu=4000 > > - setup namespaces routing ${encap}${outer_family}${inner_family} || return 2 > + setup namespaces routing ${encap}${outer_family}${inner_family} || return $ksft_skip > trace "${ns_a}" ${encap}_a "${ns_b}" ${encap}_b \ > "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ > "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B > @@ -919,7 +919,7 @@ test_pmtu_ipv6_gue6_exception() { > } > > test_pmtu_vti4_exception() { > - setup namespaces veth vti4 xfrm4 || return 2 > + setup namespaces veth vti4 xfrm4 || return $ksft_skip > trace "${ns_a}" veth_a "${ns_b}" veth_b \ > "${ns_a}" vti4_a "${ns_b}" vti4_b > > @@ -949,7 +949,7 @@ test_pmtu_vti4_exception() { > } > > test_pmtu_vti6_exception() { > - setup namespaces veth vti6 xfrm6 || return 2 > + setup namespaces veth vti6 xfrm6 || return $ksft_skip > trace "${ns_a}" veth_a "${ns_b}" veth_b \ > "${ns_a}" vti6_a "${ns_b}" vti6_b > fail=0 > @@ -979,7 +979,7 @@ test_pmtu_vti6_exception() { > } > > test_pmtu_vti4_default_mtu() { > - setup namespaces veth vti4 || return 2 > + setup namespaces veth vti4 || return $ksft_skip > > # Check that MTU of vti device is MTU of veth minus IPv4 header length > veth_mtu="$(link_get_mtu "${ns_a}" veth_a)" > @@ -991,7 +991,7 @@ test_pmtu_vti4_default_mtu() { > } > > test_pmtu_vti6_default_mtu() { > - setup namespaces veth vti6 || return 2 > + setup namespaces veth vti6 || return $ksft_skip > > # Check that MTU of vti device is MTU of veth minus IPv6 header length > veth_mtu="$(link_get_mtu "${ns_a}" veth_a)" > @@ -1003,10 +1003,10 @@ test_pmtu_vti6_default_mtu() { > } > > test_pmtu_vti4_link_add_mtu() { > - setup namespaces || return 2 > + setup namespaces || return $ksft_skip > > run_cmd ${ns_a} ip link add vti4_a type vti local ${veth4_a_addr} remote ${veth4_b_addr} key 10 > - [ $? -ne 0 ] && err " vti not supported" && return 2 > + [ $? -ne 0 ] && err " vti not supported" && return $ksft_skip > run_cmd ${ns_a} ip link del vti4_a > > fail=0 > @@ -1041,10 +1041,10 @@ test_pmtu_vti4_link_add_mtu() { > } > > test_pmtu_vti6_link_add_mtu() { > - setup namespaces || return 2 > + setup namespaces || return $ksft_skip > > run_cmd ${ns_a} ip link add vti6_a type vti6 local ${veth6_a_addr} remote ${veth6_b_addr} key 10 > - [ $? -ne 0 ] && err " vti6 not supported" && return 2 > + [ $? -ne 0 ] && err " vti6 not supported" && return $ksft_skip > run_cmd ${ns_a} ip link del vti6_a > > fail=0 > @@ -1079,10 +1079,10 @@ test_pmtu_vti6_link_add_mtu() { > } > > test_pmtu_vti6_link_change_mtu() { > - setup namespaces || return 2 > + setup namespaces || return $ksft_skip > > run_cmd ${ns_a} ip link add dummy0 mtu 1500 type dummy > - [ $? -ne 0 ] && err " dummy not supported" && return 2 > + [ $? -ne 0 ] && err " dummy not supported" && return $ksft_skip > run_cmd ${ns_a} ip link add dummy1 mtu 3000 type dummy > run_cmd ${ns_a} ip link set dummy0 up > run_cmd ${ns_a} ip link set dummy1 up > @@ -1135,10 +1135,10 @@ test_cleanup_vxlanX_exception() { > encap="vxlan" > ll_mtu=4000 > > - check_command taskset || return 2 > + check_command taskset || return $ksft_skip > cpu_list=$(grep -m 2 processor /proc/cpuinfo | cut -d ' ' -f 2) > > - setup namespaces routing ${encap}${outer} || return 2 > + setup namespaces routing ${encap}${outer} || return $ksft_skip > trace "${ns_a}" ${encap}_a "${ns_b}" ${encap}_b \ > "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ > "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B > @@ -1200,7 +1200,7 @@ run_test() { > fi > err_flush > exit 1 > - elif [ $ret -eq 2 ]; then > + elif [ $ret -eq $ksft_skip ]; then > printf "TEST: %-60s [SKIP]\n" "${tdesc}" > err_flush > fi > @@ -1223,7 +1223,7 @@ run_test_nh() { > } > > test_list_flush_ipv4_exception() { > - setup namespaces routing || return 2 > + setup namespaces routing || return $ksft_skip > trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ > "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ > "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ > @@ -1277,7 +1277,7 @@ test_list_flush_ipv4_exception() { > } > > test_list_flush_ipv6_exception() { > - setup namespaces routing || return 2 > + setup namespaces routing || return $ksft_skip > trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ > "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ > "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ > @@ -1453,7 +1453,7 @@ for t in ${tests}; do > if [ $run_this -eq 1 ]; then > run_test "${name}" "${desc}" > # if test was skipped no need to retry with nexthop objects > - [ $? -eq 2 ] && rerun_nh=0 > + [ $? -eq $ksft_skip ] && rerun_nh=0 > > if [ "${rerun_nh}" = "1" ]; then > run_test_nh "${name}" "${desc}" >
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh index 3429767..0ae9c19 100755 --- a/tools/testing/selftests/net/pmtu.sh +++ b/tools/testing/selftests/net/pmtu.sh @@ -298,7 +298,7 @@ setup_fou_or_gue() { encap="${3}" if [ "${outer}" = "4" ]; then - modprobe fou || return 2 + modprobe fou || return $ksft_skip a_addr="${prefix4}.${a_r1}.1" b_addr="${prefix4}.${b_r1}.1" if [ "${inner}" = "4" ]; then @@ -309,7 +309,7 @@ setup_fou_or_gue() { ipproto="41" fi else - modprobe fou6 || return 2 + modprobe fou6 || return $ksft_skip a_addr="${prefix6}:${a_r1}::1" b_addr="${prefix6}:${b_r1}::1" if [ "${inner}" = "4" ]; then @@ -323,8 +323,8 @@ setup_fou_or_gue() { fi fi - run_cmd ${ns_a} ip fou add port 5555 ipproto ${ipproto} || return 2 - run_cmd ${ns_a} ip link add ${encap}_a type ${type} ${mode} local ${a_addr} remote ${b_addr} encap ${encap} encap-sport auto encap-dport 5556 || return 2 + run_cmd ${ns_a} ip fou add port 5555 ipproto ${ipproto} || return $ksft_skip + run_cmd ${ns_a} ip link add ${encap}_a type ${type} ${mode} local ${a_addr} remote ${b_addr} encap ${encap} encap-sport auto encap-dport 5556 || return $ksft_skip run_cmd ${ns_b} ip fou add port 5556 ipproto ${ipproto} run_cmd ${ns_b} ip link add ${encap}_b type ${type} ${mode} local ${b_addr} remote ${a_addr} encap ${encap} encap-sport auto encap-dport 5555 @@ -672,7 +672,7 @@ check_pmtu_value() { test_pmtu_ipvX() { family=${1} - setup namespaces routing || return 2 + setup namespaces routing || return $ksft_skip trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ @@ -770,11 +770,11 @@ test_pmtu_ipvX_over_vxlanY_or_geneveY_exception() { ll_mtu=4000 if [ ${outer_family} -eq 4 ]; then - setup namespaces routing ${type}4 || return 2 + setup namespaces routing ${type}4 || return $ksft_skip # IPv4 header UDP header VXLAN/GENEVE header Ethernet header exp_mtu=$((${ll_mtu} - 20 - 8 - 8 - 14)) else - setup namespaces routing ${type}6 || return 2 + setup namespaces routing ${type}6 || return $ksft_skip # IPv6 header UDP header VXLAN/GENEVE header Ethernet header exp_mtu=$((${ll_mtu} - 40 - 8 - 8 - 14)) fi @@ -844,7 +844,7 @@ test_pmtu_ipvX_over_fouY_or_gueY() { encap=${3} ll_mtu=4000 - setup namespaces routing ${encap}${outer_family}${inner_family} || return 2 + setup namespaces routing ${encap}${outer_family}${inner_family} || return $ksft_skip trace "${ns_a}" ${encap}_a "${ns_b}" ${encap}_b \ "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B @@ -919,7 +919,7 @@ test_pmtu_ipv6_gue6_exception() { } test_pmtu_vti4_exception() { - setup namespaces veth vti4 xfrm4 || return 2 + setup namespaces veth vti4 xfrm4 || return $ksft_skip trace "${ns_a}" veth_a "${ns_b}" veth_b \ "${ns_a}" vti4_a "${ns_b}" vti4_b @@ -949,7 +949,7 @@ test_pmtu_vti4_exception() { } test_pmtu_vti6_exception() { - setup namespaces veth vti6 xfrm6 || return 2 + setup namespaces veth vti6 xfrm6 || return $ksft_skip trace "${ns_a}" veth_a "${ns_b}" veth_b \ "${ns_a}" vti6_a "${ns_b}" vti6_b fail=0 @@ -979,7 +979,7 @@ test_pmtu_vti6_exception() { } test_pmtu_vti4_default_mtu() { - setup namespaces veth vti4 || return 2 + setup namespaces veth vti4 || return $ksft_skip # Check that MTU of vti device is MTU of veth minus IPv4 header length veth_mtu="$(link_get_mtu "${ns_a}" veth_a)" @@ -991,7 +991,7 @@ test_pmtu_vti4_default_mtu() { } test_pmtu_vti6_default_mtu() { - setup namespaces veth vti6 || return 2 + setup namespaces veth vti6 || return $ksft_skip # Check that MTU of vti device is MTU of veth minus IPv6 header length veth_mtu="$(link_get_mtu "${ns_a}" veth_a)" @@ -1003,10 +1003,10 @@ test_pmtu_vti6_default_mtu() { } test_pmtu_vti4_link_add_mtu() { - setup namespaces || return 2 + setup namespaces || return $ksft_skip run_cmd ${ns_a} ip link add vti4_a type vti local ${veth4_a_addr} remote ${veth4_b_addr} key 10 - [ $? -ne 0 ] && err " vti not supported" && return 2 + [ $? -ne 0 ] && err " vti not supported" && return $ksft_skip run_cmd ${ns_a} ip link del vti4_a fail=0 @@ -1041,10 +1041,10 @@ test_pmtu_vti4_link_add_mtu() { } test_pmtu_vti6_link_add_mtu() { - setup namespaces || return 2 + setup namespaces || return $ksft_skip run_cmd ${ns_a} ip link add vti6_a type vti6 local ${veth6_a_addr} remote ${veth6_b_addr} key 10 - [ $? -ne 0 ] && err " vti6 not supported" && return 2 + [ $? -ne 0 ] && err " vti6 not supported" && return $ksft_skip run_cmd ${ns_a} ip link del vti6_a fail=0 @@ -1079,10 +1079,10 @@ test_pmtu_vti6_link_add_mtu() { } test_pmtu_vti6_link_change_mtu() { - setup namespaces || return 2 + setup namespaces || return $ksft_skip run_cmd ${ns_a} ip link add dummy0 mtu 1500 type dummy - [ $? -ne 0 ] && err " dummy not supported" && return 2 + [ $? -ne 0 ] && err " dummy not supported" && return $ksft_skip run_cmd ${ns_a} ip link add dummy1 mtu 3000 type dummy run_cmd ${ns_a} ip link set dummy0 up run_cmd ${ns_a} ip link set dummy1 up @@ -1135,10 +1135,10 @@ test_cleanup_vxlanX_exception() { encap="vxlan" ll_mtu=4000 - check_command taskset || return 2 + check_command taskset || return $ksft_skip cpu_list=$(grep -m 2 processor /proc/cpuinfo | cut -d ' ' -f 2) - setup namespaces routing ${encap}${outer} || return 2 + setup namespaces routing ${encap}${outer} || return $ksft_skip trace "${ns_a}" ${encap}_a "${ns_b}" ${encap}_b \ "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B @@ -1200,7 +1200,7 @@ run_test() { fi err_flush exit 1 - elif [ $ret -eq 2 ]; then + elif [ $ret -eq $ksft_skip ]; then printf "TEST: %-60s [SKIP]\n" "${tdesc}" err_flush fi @@ -1223,7 +1223,7 @@ run_test_nh() { } test_list_flush_ipv4_exception() { - setup namespaces routing || return 2 + setup namespaces routing || return $ksft_skip trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ @@ -1277,7 +1277,7 @@ test_list_flush_ipv4_exception() { } test_list_flush_ipv6_exception() { - setup namespaces routing || return 2 + setup namespaces routing || return $ksft_skip trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ @@ -1453,7 +1453,7 @@ for t in ${tests}; do if [ $run_this -eq 1 ]; then run_test "${name}" "${desc}" # if test was skipped no need to retry with nexthop objects - [ $? -eq 2 ] && rerun_nh=0 + [ $? -eq $ksft_skip ] && rerun_nh=0 if [ "${rerun_nh}" = "1" ]; then run_test_nh "${name}" "${desc}"