ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4] tcp_cmds/ping/ping02: Make it compatible with Busybox
Date: Wed, 11 Nov 2020 15:40:05 +0100	[thread overview]
Message-ID: <20201111144005.GA3358@pevik> (raw)
In-Reply-To: <20201110180533.28595-1-kory.maincent@bootlin.com>

Hi Kory, Alexey,

> The ping from busybox does not have -f parameter, use -i parameter instead.
> BusyBox does not accept pattern longer than 2 bytes.
> BusyBox support -i option since version 1.30

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

LGTM.

I suggest to merge with few changes below.

* more precise message "ping from old busybox?"
* use just $(tst_ipaddr rhost) instead of $ipaddr
(some time ago we've started to use function calls for these simple evaluations)
* upper case for global variable (ugly, but easily recognizable

Kind regards,
Petr

diff --git testcases/network/tcp_cmds/ping/ping02.sh testcases/network/tcp_cmds/ping/ping02.sh
index d4290c873..acf2737bf 100755
--- testcases/network/tcp_cmds/ping/ping02.sh
+++ testcases/network/tcp_cmds/ping/ping02.sh
@@ -17,13 +17,12 @@ do_setup()
 
 	tst_require_cmds $PING
 
-	ping_opts="-f -p 000102030405060708090a0b0c0d0e0f"
-	ipaddr=$(tst_ipaddr rhost)
+	PING_OPTS="-f -p 000102030405060708090a0b0c0d0e0f"
 
-	if ! $PING -c 1 -f $ipaddr >/dev/null 2>&1; then
-		ping_opts="-i 0.01 -p aa"
+	if ! $PING -c 1 -f $(tst_ipaddr rhost) >/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?)"
+			tst_brk TCONF "unsupported ping version (ping from old busybox?)"
 		fi
 	fi
 }
@@ -32,10 +31,10 @@ do_test()
 {
 	local s
 
-	tst_res TINFO "flood $PING: ICMP packets with options '$ping_opts'"
+	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
+		EXPECT_PASS $PING -c $COUNT -s $s $(tst_ipaddr rhost) $PING_OPTS \>/dev/null
 	done
 }
 

  reply	other threads:[~2020-11-11 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 18:05 [LTP] [PATCH v4] tcp_cmds/ping/ping02: Make it compatible with Busybox Kory Maincent
2020-11-11 14:40 ` Petr Vorel [this message]
2020-11-11 15:01   ` Alexey Kodanev
2020-11-11 15:06     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201111144005.GA3358@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).