diff mbox series

[1/3] netns_helper.sh: Check for ping

Message ID 20210716100415.27410-2-pvorel@suse.cz
State Accepted
Headers show
Series netns_helper.sh: cleanup | expand

Commit Message

Petr Vorel July 16, 2021, 10:04 a.m. UTC
to give more informative message than just:
netns_comm 1 TFAIL: ns_exec 48906 net ping -q -c2 -I veth0 failed unexpectedly
netns_comm 1 TFAIL: ns_exec 48908 net ping -q -c2 -I veth1 failed unexpectedly
netns_comm 1 TFAIL: ns_exec 48906 net ping -q -c2 -I lo failed unexpectedly

Use the same approach implemented in d57ac0b7a for tst_net.sh: for IPv6
ping6 is preferred (but still require ping), but fallback with warning
if only ping is available (some distros may still miss ping6 symlink
required by upstream since iputils s20150815).

Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reported in https://github.com/linux-test-project/ltp/issues/840

 testcases/kernel/containers/netns/netns_helper.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
index 1f97ec4d4..218fcef8c 100755
--- a/testcases/kernel/containers/netns/netns_helper.sh
+++ b/testcases/kernel/containers/netns/netns_helper.sh
@@ -1,11 +1,11 @@ 
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2014-2020
+# Copyright (c) Linux Test Project, 2014-2021
 # Copyright (c) 2015 Red Hat, Inc.
-TST_NEEDS_CMDS="ip modprobe"
+TST_NEEDS_CMDS="ip modprobe ping"
 . tst_test.sh
 # Set to 1 only for test cases using ifconfig (ioctl).
@@ -132,10 +132,12 @@  netns_setup()
 		IFCONF_IN6_ARG="inet6 add"
 		IP0=$6; IP1=$7;
-		if which ping6 >/dev/null 2>&1; then
+		if tst_cmd_available ping6; then
 		    tping="ping -6"
+			tst_res_ TINFO "ping6 binary/symlink is missing, using workaround. Please, report missing ping6 to your distribution."