Skip to content

Commit a7ee79b

Browse files
Paolo Abenikuba-moo
authored andcommitted
selftests: net: cope with slow env in so_txtime.sh test
The mentioned test is failing in slow environments: # SO_TXTIME ipv4 clock monotonic # ./so_txtime: recv: timeout: Resource temporarily unavailable not ok 1 selftests: net: so_txtime.sh # exit=1 Tuning the tolerance in the test binary is error-prone and doomed to failures is slow-enough environment. Just resort to suppress any error in such cases. Note to suppress them we need first to refactor a bit the code moving it to explicit error handling. Fixes: af5136f ("selftests/net: SO_TXTIME with ETF and FQ") Signed-off-by: Paolo Abeni <pabeni@redhat.com> Link: https://lore.kernel.org/r/2142d9ed4b5c5aa07dd1b455779625d91b175373.1707730902.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent e58779f commit a7ee79b

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

tools/testing/selftests/net/so_txtime.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
set -e
77

8+
readonly ksft_skip=4
89
readonly DEV="veth0"
910
readonly BIN="./so_txtime"
1011

@@ -46,7 +47,7 @@ ip -netns "${NS2}" addr add 192.168.1.2/24 dev "${DEV}"
4647
ip -netns "${NS1}" addr add fd::1/64 dev "${DEV}" nodad
4748
ip -netns "${NS2}" addr add fd::2/64 dev "${DEV}" nodad
4849

49-
do_test() {
50+
run_test() {
5051
local readonly IP="$1"
5152
local readonly CLOCK="$2"
5253
local readonly TXARGS="$3"
@@ -64,26 +65,46 @@ do_test() {
6465
fi
6566

6667
local readonly START="$(date +%s%N --date="+ 0.1 seconds")"
68+
6769
ip netns exec "${NS2}" "${BIN}" -"${IP}" -c "${CLOCK}" -t "${START}" -S "${SADDR}" -D "${DADDR}" "${RXARGS}" -r &
6870
ip netns exec "${NS1}" "${BIN}" -"${IP}" -c "${CLOCK}" -t "${START}" -S "${SADDR}" -D "${DADDR}" "${TXARGS}"
6971
wait "$!"
7072
}
7173

74+
do_test() {
75+
run_test $@
76+
[ $? -ne 0 ] && ret=1
77+
}
78+
79+
do_fail_test() {
80+
run_test $@
81+
[ $? -eq 0 ] && ret=1
82+
}
83+
7284
ip netns exec "${NS1}" tc qdisc add dev "${DEV}" root fq
85+
set +e
86+
ret=0
7387
do_test 4 mono a,-1 a,-1
7488
do_test 6 mono a,0 a,0
7589
do_test 6 mono a,10 a,10
7690
do_test 4 mono a,10,b,20 a,10,b,20
7791
do_test 6 mono a,20,b,10 b,20,a,20
7892

7993
if ip netns exec "${NS1}" tc qdisc replace dev "${DEV}" root etf clockid CLOCK_TAI delta 400000; then
80-
! do_test 4 tai a,-1 a,-1
81-
! do_test 6 tai a,0 a,0
94+
do_fail_test 4 tai a,-1 a,-1
95+
do_fail_test 6 tai a,0 a,0
8296
do_test 6 tai a,10 a,10
8397
do_test 4 tai a,10,b,20 a,10,b,20
8498
do_test 6 tai a,20,b,10 b,10,a,20
8599
else
86100
echo "tc ($(tc -V)) does not support qdisc etf. skipping"
101+
[ $ret -eq 0 ] && ret=$ksft_skip
87102
fi
88103

89-
echo OK. All tests passed
104+
if [ $ret -eq 0 ]; then
105+
echo OK. All tests passed
106+
elif [[ $ret -ne $ksft_skip && -n "$KSFT_MACHINE_SLOW" ]]; then
107+
echo "Ignoring errors due to slow environment" 1>&2
108+
ret=0
109+
fi
110+
exit $ret

0 commit comments

Comments
 (0)