selftests: forwarding: Handle 0 for packet difference in multipath tests
authorDavid Ahern <dsahern@gmail.com>
Thu, 1 Mar 2018 21:49:31 +0000 (13:49 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Mar 2018 02:19:02 +0000 (21:19 -0500)
commit5ee0902a0d584bd765165448fec8bb1409d5d027
tree726bc67a408525d0fc63a8e33267d9f127fe56ec
parent198979be6c16aa62025d5a47680f2c7849b7e64c
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>
tools/testing/selftests/net/forwarding/router_multipath.sh