]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
selftests: forwarding: lib: extract ping and ping6 so they can be reused
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Tue, 3 Jul 2018 12:42:43 +0000 (15:42 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Jul 2018 12:40:02 +0000 (21:40 +0900)
Extract ping and ping6 command execution so the return value can be
checked by the caller, this is needed for port isolation tests that are
intended to fail.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/forwarding/lib.sh

index e073918bbe15ae82b38c4a6764bc59df151fba66..2bb9cf303c538798018565049238bb4860b0b975 100644 (file)
@@ -659,30 +659,40 @@ multipath_eval()
 ##############################################################################
 # Tests
 
-ping_test()
+ping_do()
 {
        local if_name=$1
        local dip=$2
        local vrf_name
 
-       RET=0
-
        vrf_name=$(master_name_get $if_name)
        ip vrf exec $vrf_name $PING $dip -c 10 -i 0.1 -w 2 &> /dev/null
+}
+
+ping_test()
+{
+       RET=0
+
+       ping_do $1 $2
        check_err $?
        log_test "ping"
 }
 
-ping6_test()
+ping6_do()
 {
        local if_name=$1
        local dip=$2
        local vrf_name
 
-       RET=0
-
        vrf_name=$(master_name_get $if_name)
        ip vrf exec $vrf_name $PING6 $dip -c 10 -i 0.1 -w 2 &> /dev/null
+}
+
+ping6_test()
+{
+       RET=0
+
+       ping6_do $1 $2
        check_err $?
        log_test "ping6"
 }