All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Cc: Andrew Lunn <andrew@lunn.ch>, Eric Dumazet <edumazet@google.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Tristram.Ha@microchip.com,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Ravi Gunasekaran <r-gunasekaran@ti.com>,
	Simon Horman <horms@kernel.org>,
	Nikita Zhandarovich <n.zhandarovich@fintech.ru>,
	Murali Karicheri <m-karicheri2@ti.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Ziyang Xuan <william.xuanziyang@huawei.com>,
	Shigeru Yoshida <syoshida@redhat.com>,
	"Ricardo B. Marliere" <ricardo@marliere.net>,
	linux-kernel@vger.kernel.org, Lukasz Majewski <lukma@denx.de>
Subject: [net-next PATCH v5 3/4] test: hsr: Extract version agnostic information from ping command output
Date: Mon, 15 Apr 2024 14:49:27 +0200	[thread overview]
Message-ID: <20240415124928.1263240-4-lukma@denx.de> (raw)
In-Reply-To: <20240415124928.1263240-1-lukma@denx.de>

Current code checks if ping command output match hardcoded pattern:
"10 packets transmitted, 10 received, 0% packet loss,".

Such approach will work only from one ping program version (for which
this test has been originally written).
This patch address problem when ping with different summary output
like "10 packets transmitted, 10 packets received, 0% packet" is
used to run this test - for example one from busybox (as the test
system runs in QEMU with rootfs created with buildroot).

The fix is to modify output of ping command to be agnostic to ping
version used on the platform.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 tools/testing/selftests/net/hsr/hsr_common.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/hsr/hsr_common.sh b/tools/testing/selftests/net/hsr/hsr_common.sh
index 822165391573..9ae2723f6a48 100644
--- a/tools/testing/selftests/net/hsr/hsr_common.sh
+++ b/tools/testing/selftests/net/hsr/hsr_common.sh
@@ -64,7 +64,8 @@ do_ping_long()
 	fi
 
 	VAL="$(echo $OUT | cut -d' ' -f1-8)"
-	if [ "$VAL" != "10 packets transmitted, 10 received, 0% packet loss," ]
+	SED_VAL="$(echo ${VAL} | sed -r -e 's/([0-9]{2}).*([0-9]{2}).*[[:space:]]([0-9]+%).*/\1 transmitted \2 received \3 loss/')"
+	if [ "${SED_VAL}" != "10 transmitted 10 received 0% loss" ]
 	then
 		echo "$netns -> $connect_addr ping TEST [ FAIL ]"
 		echo "Expect to send and receive 10 packets and no duplicates."
-- 
2.20.1


  parent reply	other threads:[~2024-04-15 12:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 12:49 [net-next PATCH v5 0/4] net: hsr: Add support for HSR-SAN (RedBOX) Lukasz Majewski
2024-04-15 12:49 ` [net-next PATCH v5 1/4] net: hsr: Provide RedBox support (HSR-SAN) Lukasz Majewski
2024-04-16 10:21   ` Casper Andersson
2024-04-16 13:03     ` Lukasz Majewski
2024-04-18 13:35       ` Casper Andersson
2024-04-18 15:37         ` Lukasz Majewski
2024-04-19  9:01           ` Casper Andersson
2024-04-19 10:42             ` Lukasz Majewski
2024-04-19 13:49               ` Casper Andersson
2024-04-19 14:05                 ` Lukasz Majewski
2024-04-29  9:32                 ` Lukasz Majewski
2024-04-18  8:47   ` Paolo Abeni
2024-04-18 10:53     ` Lukasz Majewski
2024-04-19 10:31   ` Casper Andersson
2024-04-15 12:49 ` [net-next PATCH v5 2/4] test: hsr: Move common code to hsr_common.sh file Lukasz Majewski
2024-04-18  8:41   ` Paolo Abeni
2024-04-18  8:45     ` Paolo Abeni
2024-04-15 12:49 ` Lukasz Majewski [this message]
2024-04-15 12:49 ` [net-next PATCH v5 4/4] test: hsr: Add test for HSR RedBOX (HSR-SAN) mode of operation Lukasz Majewski
2024-04-18  8:43   ` Paolo Abeni
2024-04-15 13:07 ` [net-next PATCH v5 0/4] net: hsr: Add support for HSR-SAN (RedBOX) Lukasz Majewski
2024-04-18  8:49 ` Paolo Abeni

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=20240415124928.1263240-4-lukma@denx.de \
    --to=lukma@denx.de \
    --cc=Tristram.Ha@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=bigeasy@linutronix.de \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=n.zhandarovich@fintech.ru \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=r-gunasekaran@ti.com \
    --cc=ricardo@marliere.net \
    --cc=syoshida@redhat.com \
    --cc=william.xuanziyang@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.