[SRU][Focal][PATCH 1/1] UBUNTU: SAUCE: selftests/net: skipping tests for older ip command releases

Jose Ogando jose.ogando at canonical.com
Wed Oct 5 20:41:04 UTC 2022


BugLink: https://bugs.launchpad.net/bugs/1990800

When running fib_nexthop_nongw from V5.4 on older releases (i.e.
Bionic) the nexthop ip subcommand is not available.
This patch queries ip capabilities beforehand, and will execute
or skip where aplicable.

Signed-off-by: Jose Ogando <jose.ogando at canonical.com>
---
 .../selftests/net/fib_nexthop_nongw.sh        | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/net/fib_nexthop_nongw.sh b/tools/testing/selftests/net/fib_nexthop_nongw.sh
index b7b928b38ce4..6d79ed88b48b 100755
--- a/tools/testing/selftests/net/fib_nexthop_nongw.sh
+++ b/tools/testing/selftests/net/fib_nexthop_nongw.sh
@@ -108,12 +108,20 @@ do
 	esac
 done
 
-cleanup
-setup
+ip nexthop help 2>&1 | grep -q "unknown"
+if [ $? -eq 0 ]; then
+	echo "SKIP: ip nexthop: ip command too old"
+	ret=0
+else
 
-run_cmd ip -netns h1 route get 192.168.1.1
-log_test $? 0 "nexthop: get route with nexthop without gw"
-run_cmd ip netns exec h1 ping -c1 192.168.1.1
-log_test $? 0 "nexthop: ping through nexthop without gw"
+	cleanup
+	setup
+
+	run_cmd ip -netns h1 route get 192.168.1.1
+	log_test $? 0 "nexthop: get route with nexthop without gw"
+	run_cmd ip netns exec h1 ping -c1 192.168.1.1
+	log_test $? 0 "nexthop: ping through nexthop without gw"
+
+fi
 
 exit $ret
-- 
2.34.1




More information about the kernel-team mailing list