ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH v3] tcp_cmds/ping/ping02: Make it compatible with Busybox
@ 2020-11-09 19:16 Kory Maincent
  2020-11-10 12:28 ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: Kory Maincent @ 2020-11-09 19:16 UTC (permalink / raw)
  To: ltp

The ping from busybox does not have -f parameter, use -i parameter instead.
BusyBox does not accept pattern longer than 2 bytes.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---

Changes since v1:
 - Use "-i 0.01 -p aa" parameter instead of "-f"

Changes since v2:
 - Use "-i 0.01 -p aa" only in the case of "-f" parameter is not valid

 testcases/network/tcp_cmds/ping/ping02.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/testcases/network/tcp_cmds/ping/ping02.sh b/testcases/network/tcp_cmds/ping/ping02.sh
index e0a63c5f6..80346c552 100755
--- a/testcases/network/tcp_cmds/ping/ping02.sh
+++ b/testcases/network/tcp_cmds/ping/ping02.sh
@@ -20,15 +20,16 @@ do_setup()
 
 do_test()
 {
-	local pat="000102030405060708090a0b0c0d0e0f"
-
-	tst_res TINFO "flood $PING: ICMP packets filled with pattern '$pat'"
-
+	local ping_opts="-f -p 000102030405060708090a0b0c0d0e0f"
 	local ipaddr=$(tst_ipaddr rhost)
 	local s
 
+	$PING -c 1 -f $ipaddr >/dev/null 2>&1 || ping_opts="-i 0.01 -p aa"
+
+	tst_res TINFO "flood $PING: ICMP packets with options '$ping_opts'"
+
 	for s in $PACKETSIZES; do
-		EXPECT_PASS $PING -c $COUNT -f -s $s $ipaddr -p "$pat" \>/dev/null
+		EXPECT_PASS $PING -c $COUNT -s $s $ipaddr $ping_opts \>/dev/null
 	done
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH v3] tcp_cmds/ping/ping02: Make it compatible with Busybox
  2020-11-09 19:16 [LTP] [PATCH v3] tcp_cmds/ping/ping02: Make it compatible with Busybox Kory Maincent
@ 2020-11-10 12:28 ` Petr Vorel
  2020-11-10 12:36   ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2020-11-10 12:28 UTC (permalink / raw)
  To: ltp

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.

> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---

> Changes since v1:
>  - Use "-i 0.01 -p aa" parameter instead of "-f"

> Changes since v2:
>  - Use "-i 0.01 -p aa" only in the case of "-f" parameter is not valid

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

-i option was added in busybox 1.30 (2 years old), it'd be good to note that in
the commit message.

I have in my TODO list C/shell API helper which would help to verify command
version.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH v3] tcp_cmds/ping/ping02: Make it compatible with Busybox
  2020-11-10 12:28 ` Petr Vorel
@ 2020-11-10 12:36   ` Petr Vorel
  2020-11-10 14:31     ` Alexey Kodanev
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2020-11-10 12:36 UTC (permalink / raw)
  To: ltp

Hi Kory, Alexey,

> -i option was added in busybox 1.30 (2 years old), it'd be good to note that in
> the commit message.
Actually, maybe also test -i option and if even -i not working run?

tst_brk TCONF "unsupported ping version (old busybox?)"

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH v3] tcp_cmds/ping/ping02: Make it compatible with Busybox
  2020-11-10 12:36   ` Petr Vorel
@ 2020-11-10 14:31     ` Alexey Kodanev
  2020-11-10 14:54       ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kodanev @ 2020-11-10 14:31 UTC (permalink / raw)
  To: ltp

On 10.11.2020 15:36, Petr Vorel wrote:
> Hi Kory, Alexey,
> 
>> -i option was added in busybox 1.30 (2 years old), it'd be good to note that in
>> the commit message.
> Actually, maybe also test -i option and if even -i not working run?
> 
> tst_brk TCONF "unsupported ping version (old busybox?)"

Hi Petr,

What if it failed for some other reason, it would be a wrong assumption
that ping doesn't support -i...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH v3] tcp_cmds/ping/ping02: Make it compatible with Busybox
  2020-11-10 14:31     ` Alexey Kodanev
@ 2020-11-10 14:54       ` Petr Vorel
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2020-11-10 14:54 UTC (permalink / raw)
  To: ltp

Hi Kory, Alexey,

> On 10.11.2020 15:36, Petr Vorel wrote:
> > Hi Kory, Alexey,

> >> -i option was added in busybox 1.30 (2 years old), it'd be good to note that in
> >> the commit message.
> > Actually, maybe also test -i option and if even -i not working run?

> > tst_brk TCONF "unsupported ping version (old busybox?)"

> Hi Petr,

> What if it failed for some other reason, it would be a wrong assumption
> that ping doesn't support -i...
Yep, that'd be bad.
Thus maybe just check
$PING 2>&1 |grep -q -- -i

in case of busybox?

If you don't like it, at least put tst_res TINFO message in case of busybox.
(but I'd prefer this check).

And maybe move $ping_opts and this check to setup.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-10 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-09 19:16 [LTP] [PATCH v3] tcp_cmds/ping/ping02: Make it compatible with Busybox Kory Maincent
2020-11-10 12:28 ` Petr Vorel
2020-11-10 12:36   ` Petr Vorel
2020-11-10 14:31     ` Alexey Kodanev
2020-11-10 14:54       ` Petr Vorel

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).