[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411233624.8129-10-fw@strlen.de>
Date: Fri, 12 Apr 2024 01:36:14 +0200
From: Florian Westphal <fw@...len.de>
To: <netdev@...r.kernel.org>
Cc: <netfilter-devel@...r.kernel.org>,
Paolo Abeni <pabeni@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Pablo Neira Ayuso <pablo@...filter.org>
Subject: [PATCH net-next 09/15] selftests: netfilter: place checktool helper in lib.sh
... so it doesn't have to be repeated everywhere.
Signed-off-by: Florian Westphal <fw@...len.de>
---
tools/testing/selftests/net/netfilter/br_netfilter.sh | 6 +-----
.../testing/selftests/net/netfilter/conntrack_ipip_mtu.sh | 7 -------
tools/testing/selftests/net/netfilter/lib.sh | 7 +++++++
3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/tools/testing/selftests/net/netfilter/br_netfilter.sh b/tools/testing/selftests/net/netfilter/br_netfilter.sh
index ea3afd6d401f..1084faf88f0b 100755
--- a/tools/testing/selftests/net/netfilter/br_netfilter.sh
+++ b/tools/testing/selftests/net/netfilter/br_netfilter.sh
@@ -11,11 +11,7 @@
source lib.sh
-nft --version > /dev/null 2>&1
-if [ $? -ne 0 ];then
- echo "SKIP: Could not run test without nft tool"
- exit $ksft_skip
-fi
+checktool "nft --version" "run test without nft tool"
cleanup() {
cleanup_all_ns
diff --git a/tools/testing/selftests/net/netfilter/conntrack_ipip_mtu.sh b/tools/testing/selftests/net/netfilter/conntrack_ipip_mtu.sh
index f87ca4c59d3b..ac0dff0f80d7 100755
--- a/tools/testing/selftests/net/netfilter/conntrack_ipip_mtu.sh
+++ b/tools/testing/selftests/net/netfilter/conntrack_ipip_mtu.sh
@@ -24,13 +24,6 @@ source lib.sh
rx=$(mktemp)
-checktool (){
- if ! $1 > /dev/null 2>&1; then
- echo "SKIP: Could not $2"
- exit $ksft_skip
- fi
-}
-
checktool "iptables --version" "run test without iptables"
checktool "socat -h" "run test without socat"
diff --git a/tools/testing/selftests/net/netfilter/lib.sh b/tools/testing/selftests/net/netfilter/lib.sh
index eb109eb527db..bedd35298e15 100644
--- a/tools/testing/selftests/net/netfilter/lib.sh
+++ b/tools/testing/selftests/net/netfilter/lib.sh
@@ -1,3 +1,10 @@
net_netfilter_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
source "$net_netfilter_dir/../lib.sh"
+
+checktool (){
+ if ! $1 > /dev/null 2>&1; then
+ echo "SKIP: Could not $2"
+ exit $ksft_skip
+ fi
+}
--
2.43.2
Powered by blists - more mailing lists