[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240415124928.1263240-4-lukma@denx.de>
Date: Mon, 15 Apr 2024 14:49:27 +0200
From: Lukasz Majewski <lukma@...x.de>
To: netdev@...r.kernel.org,
Paolo Abeni <pabeni@...hat.com>
Cc: Andrew Lunn <andrew@...n.ch>,
Eric Dumazet <edumazet@...gle.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Oleksij Rempel <o.rempel@...gutronix.de>,
Tristram.Ha@...rochip.com,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Ravi Gunasekaran <r-gunasekaran@...com>,
Simon Horman <horms@...nel.org>,
Nikita Zhandarovich <n.zhandarovich@...tech.ru>,
Murali Karicheri <m-karicheri2@...com>,
Jiri Pirko <jiri@...nulli.us>,
Dan Carpenter <dan.carpenter@...aro.org>,
Ziyang Xuan <william.xuanziyang@...wei.com>,
Shigeru Yoshida <syoshida@...hat.com>,
"Ricardo B. Marliere" <ricardo@...liere.net>,
linux-kernel@...r.kernel.org,
Lukasz Majewski <lukma@...x.de>
Subject: [net-next PATCH v5 3/4] test: hsr: Extract version agnostic information from ping command output
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@...x.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
Powered by blists - more mailing lists