Skip to content

Commit

Permalink
selftests: fib_nexthops: Make the test more robust
Browse files Browse the repository at this point in the history
Rarely some of the test cases fail. Make the test more robust by increasing
the timeout of ping commands to 5 seconds.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Amit Cohen authored and David S. Miller committed May 13, 2022
1 parent b7da9c6 commit 49bb39b
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions tools/testing/selftests/net/fib_nexthops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -882,40 +882,40 @@ ipv6_fcnal_runtime()
log_test $? 0 "Route delete"

run_cmd "$IP ro add 2001:db8:101::1/128 nhid 81"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 0 "Ping with nexthop"

run_cmd "$IP nexthop add id 82 via 2001:db8:92::2 dev veth3"
run_cmd "$IP nexthop add id 122 group 81/82"
run_cmd "$IP ro replace 2001:db8:101::1/128 nhid 122"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 0 "Ping - multipath"

#
# IPv6 with blackhole nexthops
#
run_cmd "$IP -6 nexthop add id 83 blackhole"
run_cmd "$IP ro replace 2001:db8:101::1/128 nhid 83"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 2 "Ping - blackhole"

run_cmd "$IP nexthop replace id 83 via 2001:db8:91::2 dev veth1"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 0 "Ping - blackhole replaced with gateway"

run_cmd "$IP -6 nexthop replace id 83 blackhole"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 2 "Ping - gateway replaced by blackhole"

run_cmd "$IP ro replace 2001:db8:101::1/128 nhid 122"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
if [ $? -eq 0 ]; then
run_cmd "$IP nexthop replace id 122 group 83"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 2 "Ping - group with blackhole"

run_cmd "$IP nexthop replace id 122 group 81/82"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 0 "Ping - group blackhole replaced with gateways"
else
log_test 2 0 "Ping - multipath failed"
Expand Down Expand Up @@ -1003,10 +1003,10 @@ ipv6_fcnal_runtime()
run_cmd "$IP nexthop add id 92 via 2001:db8:92::2 dev veth3"
run_cmd "$IP nexthop add id 93 group 91/92"
run_cmd "$IP -6 ro add default nhid 91"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 0 "Nexthop with default route and rpfilter"
run_cmd "$IP -6 ro replace default nhid 93"
run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1"
run_cmd "ip netns exec me ping -c1 -w5 2001:db8:101::1"
log_test $? 0 "Nexthop with multipath default route and rpfilter"

# TO-DO:
Expand Down Expand Up @@ -1460,13 +1460,13 @@ ipv4_fcnal_runtime()
#
run_cmd "$IP nexthop replace id 21 via 172.16.1.2 dev veth1"
run_cmd "$IP ro replace 172.16.101.1/32 nhid 21"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "Basic ping"

run_cmd "$IP nexthop replace id 22 via 172.16.2.2 dev veth3"
run_cmd "$IP nexthop add id 122 group 21/22"
run_cmd "$IP ro replace 172.16.101.1/32 nhid 122"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "Ping - multipath"

run_cmd "$IP ro delete 172.16.101.1/32 nhid 122"
Expand All @@ -1477,7 +1477,7 @@ ipv4_fcnal_runtime()
run_cmd "$IP nexthop add id 501 via 172.16.1.2 dev veth1"
run_cmd "$IP ro add default nhid 501"
run_cmd "$IP ro add default via 172.16.1.3 dev veth1 metric 20"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "Ping - multiple default routes, nh first"

# flip the order
Expand All @@ -1486,7 +1486,7 @@ ipv4_fcnal_runtime()
run_cmd "$IP ro add default via 172.16.1.2 dev veth1 metric 20"
run_cmd "$IP nexthop replace id 501 via 172.16.1.3 dev veth1"
run_cmd "$IP ro add default nhid 501 metric 20"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "Ping - multiple default routes, nh second"

run_cmd "$IP nexthop delete nhid 501"
Expand All @@ -1497,26 +1497,26 @@ ipv4_fcnal_runtime()
#
run_cmd "$IP nexthop add id 23 blackhole"
run_cmd "$IP ro replace 172.16.101.1/32 nhid 23"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 2 "Ping - blackhole"

run_cmd "$IP nexthop replace id 23 via 172.16.1.2 dev veth1"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "Ping - blackhole replaced with gateway"

run_cmd "$IP nexthop replace id 23 blackhole"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 2 "Ping - gateway replaced by blackhole"

run_cmd "$IP ro replace 172.16.101.1/32 nhid 122"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
if [ $? -eq 0 ]; then
run_cmd "$IP nexthop replace id 122 group 23"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 2 "Ping - group with blackhole"

run_cmd "$IP nexthop replace id 122 group 21/22"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "Ping - group blackhole replaced with gateways"
else
log_test 2 0 "Ping - multipath failed"
Expand All @@ -1543,7 +1543,7 @@ ipv4_fcnal_runtime()
run_cmd "$IP nexthop add id 24 via ${lladdr} dev veth1"
set +e
run_cmd "$IP ro replace 172.16.101.1/32 nhid 24"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "IPv6 nexthop with IPv4 route"

$IP neigh sh | grep -q "${lladdr} dev veth1"
Expand All @@ -1567,11 +1567,11 @@ ipv4_fcnal_runtime()

check_route "172.16.101.1" "172.16.101.1 nhid 101 nexthop via inet6 ${lladdr} dev veth1 weight 1 nexthop via 172.16.1.2 dev veth1 weight 1"

run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "IPv6 nexthop with IPv4 route"

run_cmd "$IP ro replace 172.16.101.1/32 via inet6 ${lladdr} dev veth1"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "IPv4 route with IPv6 gateway"

$IP neigh sh | grep -q "${lladdr} dev veth1"
Expand All @@ -1588,7 +1588,7 @@ ipv4_fcnal_runtime()

run_cmd "$IP ro del 172.16.101.1/32 via inet6 ${lladdr} dev veth1"
run_cmd "$IP -4 ro add default via inet6 ${lladdr} dev veth1"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
run_cmd "ip netns exec me ping -c1 -w5 172.16.101.1"
log_test $? 0 "IPv4 default route with IPv6 gateway"

#
Expand Down

0 comments on commit 49bb39b

Please sign in to comment.