summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-03-02 00:49:31 +0300
committerDavid S. Miller <davem@davemloft.net>2018-03-02 05:19:02 +0300
commit5ee0902a0d584bd765165448fec8bb1409d5d027 (patch)
tree726bc67a408525d0fc63a8e33267d9f127fe56ec /tools
parent198979be6c16aa62025d5a47680f2c7849b7e64c (diff)
downloadlinux-5ee0902a0d584bd765165448fec8bb1409d5d027.tar.xz
selftests: forwarding: Handle 0 for packet difference in multipath tests
If the packet stats have a difference of 0, the test output shows: INFO: Expected ratio 2.00 Measured ratio Runtime error (func=(main), adr=9): Divide by zero (standard_in) 2: syntax error (standard_in) 1: syntax error ./router_multipath.sh: line 187: test: : integer expression expected TEST: Multipath [FAIL] Too large discrepancy between expected and measured ratios Handle the 0 and display a cleaner message: INFO: Running IPv6 multipath tests TEST: Multipath [FAIL] Packet difference is 0 Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/net/forwarding/router_multipath.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/router_multipath.sh b/tools/testing/selftests/net/forwarding/router_multipath.sh
index d31888e3133e..c1a437c5b15f 100755
--- a/tools/testing/selftests/net/forwarding/router_multipath.sh
+++ b/tools/testing/selftests/net/forwarding/router_multipath.sh
@@ -168,6 +168,13 @@ multipath_eval()
RET=0
+ if [[ "$packets_rp12" -eq "0" || "$packets_rp13" -eq "0" ]]; then
+ check_err 1 "Packet difference is 0"
+ log_test "Multipath"
+ log_info "Expected ratio $weights_ratio"
+ return
+ fi
+
if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then
weights_ratio=$(echo "scale=2; $weight_rp12 / $weight_rp13" \
| bc -l)