diff mbox series

[2/2] network/ping02: use tst_ping() from the library

Message ID 20201208162440.14538-2-alexey.kodanev@oracle.com
State Accepted
Headers show
Series [1/2] lib/tst_net.sh: add getopts to tst_ping() | expand

Commit Message

Alexey Kodanev Dec. 8, 2020, 4:24 p.m. UTC
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/tcp_cmds/ping/ping02.sh | 30 ++---------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

Comments

Petr Vorel Dec. 11, 2020, 8:55 a.m. UTC | #1
Hi Alexey,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr
Alexey Kodanev Dec. 14, 2020, 11:48 a.m. UTC | #2
On 11.12.2020 11:55, Petr Vorel wrote:
> Hi Alexey,
> 
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>

Petr, thanks for the review!

Applied.
diff mbox series

Patch

diff --git a/testcases/network/tcp_cmds/ping/ping02.sh b/testcases/network/tcp_cmds/ping/ping02.sh
index d4290c873..07a713531 100755
--- a/testcases/network/tcp_cmds/ping/ping02.sh
+++ b/testcases/network/tcp_cmds/ping/ping02.sh
@@ -2,41 +2,15 @@ 
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016-2019 Oracle and/or its affiliates. All Rights Reserved.
 
-TST_SETUP="do_setup"
 TST_TESTFUNC="do_test"
 TST_NEEDS_ROOT=1
 
 . tst_net.sh
 
-do_setup()
-{
-	COUNT=${COUNT:-3}
-	PACKETSIZES=${PACKETSIZES:-"8 16 32 64 128 256 512 1024 2048 4064"}
-
-	PING=ping${TST_IPV6}
-
-	tst_require_cmds $PING
-
-	ping_opts="-f -p 000102030405060708090a0b0c0d0e0f"
-	ipaddr=$(tst_ipaddr rhost)
-
-	if ! $PING -c 1 -f $ipaddr >/dev/null 2>&1; then
-		ping_opts="-i 0.01 -p aa"
-		if $PING -i 2>&1 | grep -q "invalid option"; then
-			tst_brk TCONF "unsupported ping version (old busybox?)"
-		fi
-	fi
-}
-
 do_test()
 {
-	local s
-
-	tst_res TINFO "flood $PING: ICMP packets with options '$ping_opts'"
-
-	for s in $PACKETSIZES; do
-		EXPECT_PASS $PING -c $COUNT -s $s $ipaddr $ping_opts \>/dev/null
-	done
+	tst_ping -s "${PACKETSIZES:-8 16 32 64 128 256 512 1024 2048 4064}" \
+		 -p "000102030405060708090a0b0c0d0e0f" -c "${COUNT:-3}"
 }
 
 tst_run