Skip to content

Commit 7167395

Browse files
liuhangbindavem330
authored andcommitted
selftests: udpgro: report error when receive failed
Currently, we only check the latest senders's exit code. If the receiver report failed, it is not recoreded. Fix it by checking the exit code of all the involved processes. Before: bad GRO lookup ok multiple GRO socks ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 failed $ echo $? 0 After: bad GRO lookup ok multiple GRO socks ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 failed $ echo $? 1 Fixes: 3327a9c ("selftests: add functionals test for UDP GRO") Suggested-by: Paolo Abeni <[email protected]> Signed-off-by: Hangbin Liu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2d74230 commit 7167395

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

tools/testing/selftests/net/udpgro.sh

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,19 @@ run_one() {
4646
local -r all="$@"
4747
local -r tx_args=${all%rx*}
4848
local -r rx_args=${all#*rx}
49+
local ret=0
4950

5051
cfg_veth
5152

52-
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} && \
53-
echo "ok" || \
54-
echo "failed" &
53+
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} &
54+
local PID1=$!
5555

5656
wait_local_port_listen ${PEER_NS} 8000 udp
5757
./udpgso_bench_tx ${tx_args}
58-
ret=$?
59-
wait $(jobs -p)
58+
check_err $?
59+
wait ${PID1}
60+
check_err $?
61+
[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
6062
return $ret
6163
}
6264

@@ -73,6 +75,7 @@ run_one_nat() {
7375
local -r all="$@"
7476
local -r tx_args=${all%rx*}
7577
local -r rx_args=${all#*rx}
78+
local ret=0
7679

7780
if [[ ${tx_args} = *-4* ]]; then
7881
ipt_cmd=iptables
@@ -93,16 +96,17 @@ run_one_nat() {
9396
# ... so that GRO will match the UDP_GRO enabled socket, but packets
9497
# will land on the 'plain' one
9598
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -G ${family} -b ${addr1} -n 0 &
96-
pid=$!
97-
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/*} ${rx_args} && \
98-
echo "ok" || \
99-
echo "failed"&
99+
local PID1=$!
100+
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/*} ${rx_args} &
101+
local PID2=$!
100102

101103
wait_local_port_listen "${PEER_NS}" 8000 udp
102104
./udpgso_bench_tx ${tx_args}
103-
ret=$?
104-
kill -INT $pid
105-
wait $(jobs -p)
105+
check_err $?
106+
kill -INT ${PID1}
107+
wait ${PID2}
108+
check_err $?
109+
[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
106110
return $ret
107111
}
108112

@@ -111,20 +115,26 @@ run_one_2sock() {
111115
local -r all="$@"
112116
local -r tx_args=${all%rx*}
113117
local -r rx_args=${all#*rx}
118+
local ret=0
114119

115120
cfg_veth
116121

117122
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} -p 12345 &
118-
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} && \
119-
echo "ok" || \
120-
echo "failed" &
123+
local PID1=$!
124+
ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} &
125+
local PID2=$!
121126

122127
wait_local_port_listen "${PEER_NS}" 12345 udp
123128
./udpgso_bench_tx ${tx_args} -p 12345
129+
check_err $?
124130
wait_local_port_listen "${PEER_NS}" 8000 udp
125131
./udpgso_bench_tx ${tx_args}
126-
ret=$?
127-
wait $(jobs -p)
132+
check_err $?
133+
wait ${PID1}
134+
check_err $?
135+
wait ${PID2}
136+
check_err $?
137+
[ "$ret" -eq 0 ] && echo "ok" || echo "failed"
128138
return $ret
129139
}
130140

0 commit comments

Comments
 (0)