Skip to content

Commit

Permalink
selftests: forwarding: lib: extract ping and ping6 so they can be reused
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nikolay Aleksandrov authored and David S. Miller committed Jul 4, 2018
1 parent f744c4b commit 967450c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions tools/testing/selftests/net/forwarding/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down

0 comments on commit 967450c

Please sign in to comment.