selftests: forwarding: Make ping timeout configurable
authorIdo Schimmel <idosch@mellanox.com>
Thu, 31 Jan 2019 22:35:10 +0000 (22:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Feb 2019 23:26:36 +0000 (15:26 -0800)
The current timeout (2 seconds) proved to be too low for some (emulated)
systems where we run the tests.

Make the timeout configurable and default to 5 seconds.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh
tools/testing/selftests/drivers/net/mlxsw/qos_dscp_router.sh
tools/testing/selftests/net/forwarding/forwarding.config.sample
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/forwarding/mirror_lib.sh
tools/testing/selftests/net/forwarding/router_broadcast.sh

index 1ca631d5aabad65b5cb3ba0f315bcbff2245ce40..111baedc57426ec0df6231e97d8d226e374559ce 100755 (executable)
@@ -150,7 +150,7 @@ dscp_ping_test()
 
        ip vrf exec $vrf_name \
           ${PING} -Q $dscp_10 ${sip:+-I $sip} $dip \
-                  -c 10 -i 0.1 -w 2 &> /dev/null
+                  -c 10 -i 0.1 -w $PING_TIMEOUT &> /dev/null
 
        local -A t1s
        eval "t1s=($(dscp_fetch_stats $dev_10 10)
index 281d90766e1259d93cdb9adf0f13ba57faec3be3..6fa717ef91ef8266244e62870c196b49777be6f3 100755 (executable)
@@ -171,7 +171,7 @@ dscp_ping_test()
 
        ip vrf exec $vrf_name \
           ${PING} -Q $dscp ${sip:+-I $sip} $dip \
-                  -c 10 -i 0.1 -w 2 &> /dev/null
+                  -c 10 -i 0.1 -w $PING_TIMEOUT &> /dev/null
 
        eval "local -A dev1_t1s=($(dscp_fetch_stats $dev1 0))"
        eval "local -A dev2_t1s=($(dscp_fetch_stats $dev2 0))"
index e819d049d9ce15a8776071785a7a7424c8e8c558..e2adb533c8fcbfa375abf87d1c533b33803486fc 100644 (file)
@@ -33,3 +33,6 @@ PAUSE_ON_CLEANUP=no
 NETIF_TYPE=veth
 # Whether to create virtual interfaces (veth) or not
 NETIF_CREATE=yes
+# Timeout (in seconds) before ping exits regardless of how many packets have
+# been sent or received
+PING_TIMEOUT=5
index c1f16bb992dc6370aa142125752ba4a31c806270..9385dc97126993642bf7a24b183d397bf686b2f6 100644 (file)
@@ -17,6 +17,7 @@ NETIF_TYPE=${NETIF_TYPE:=veth}
 NETIF_CREATE=${NETIF_CREATE:=yes}
 MCD=${MCD:=smcrouted}
 MC_CLI=${MC_CLI:=smcroutectl}
+PING_TIMEOUT=${PING_TIMEOUT:=5}
 
 relative_path="${BASH_SOURCE%/*}"
 if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then
@@ -820,7 +821,8 @@ ping_do()
        local vrf_name
 
        vrf_name=$(master_name_get $if_name)
-       ip vrf exec $vrf_name $PING $args $dip -c 10 -i 0.1 -w 2 &> /dev/null
+       ip vrf exec $vrf_name \
+               $PING $args $dip -c 10 -i 0.1 -w $PING_TIMEOUT &> /dev/null
 }
 
 ping_test()
@@ -840,7 +842,8 @@ ping6_do()
        local vrf_name
 
        vrf_name=$(master_name_get $if_name)
-       ip vrf exec $vrf_name $PING6 $args $dip -c 10 -i 0.1 -w 2 &> /dev/null
+       ip vrf exec $vrf_name \
+               $PING6 $args $dip -c 10 -i 0.1 -w $PING_TIMEOUT &> /dev/null
 }
 
 ping6_test()
index 07991e1025c70e0e1f5e084fbcef94b7bbaed173..a1c0389eb04971b351011ab055c75928ccdf611f 100644 (file)
@@ -31,7 +31,8 @@ mirror_test()
 
        local t0=$(tc_rule_stats_get $dev $pref)
        ip vrf exec $vrf_name \
-          ${PING} ${sip:+-I $sip} $dip -c 10 -i 0.1 -w 2 &> /dev/null
+          ${PING} ${sip:+-I $sip} $dip -c 10 -i 0.1 -w $PING_TIMEOUT \
+          &> /dev/null
        local t1=$(tc_rule_stats_get $dev $pref)
        local delta=$((t1 - t0))
        # Tolerate a couple stray extra packets.
index 7bd2ebb6e9de69ff329ad473e189720c5d2f3596..9a678ece32b4db41f00a8445544bdbf98a00ffd5 100755 (executable)
@@ -170,7 +170,8 @@ ping_test_from()
 
        log_info "ping $dip, expected reply from $from"
        ip vrf exec $(master_name_get $oif) \
-       $PING -I $oif $dip -c 10 -i 0.1 -w 2 -b 2>&1 | grep $from &> /dev/null
+               $PING -I $oif $dip -c 10 -i 0.1 -w $PING_TIMEOUT -b 2>&1 \
+               | grep $from &> /dev/null
        check_err_fail $fail $?
 }