Skip to content

Commit 967450c

Browse files
Nikolay Aleksandrovdavem330
authored andcommitted
selftests: forwarding: lib: extract ping and ping6 so they can be reused
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>
1 parent f744c4b commit 967450c

File tree

1 file changed

+16
-6
lines changed
  • tools/testing/selftests/net/forwarding

1 file changed

+16
-6
lines changed

tools/testing/selftests/net/forwarding/lib.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -659,30 +659,40 @@ multipath_eval()
659659
##############################################################################
660660
# Tests
661661

662-
ping_test()
662+
ping_do()
663663
{
664664
local if_name=$1
665665
local dip=$2
666666
local vrf_name
667667

668-
RET=0
669-
670668
vrf_name=$(master_name_get $if_name)
671669
ip vrf exec $vrf_name $PING $dip -c 10 -i 0.1 -w 2 &> /dev/null
670+
}
671+
672+
ping_test()
673+
{
674+
RET=0
675+
676+
ping_do $1 $2
672677
check_err $?
673678
log_test "ping"
674679
}
675680

676-
ping6_test()
681+
ping6_do()
677682
{
678683
local if_name=$1
679684
local dip=$2
680685
local vrf_name
681686

682-
RET=0
683-
684687
vrf_name=$(master_name_get $if_name)
685688
ip vrf exec $vrf_name $PING6 $dip -c 10 -i 0.1 -w 2 &> /dev/null
689+
}
690+
691+
ping6_test()
692+
{
693+
RET=0
694+
695+
ping6_do $1 $2
686696
check_err $?
687697
log_test "ping6"
688698
}

0 commit comments

Comments
 (0)