Commit 10e2ed3f authored by Florian Westphal's avatar Florian Westphal Committed by Jakub Kicinski
Browse files

selftests: netfilter: place checktool helper in lib.sh



... so it doesn't have to be repeated everywhere.

Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Link: https://lore.kernel.org/r/20240411233624.8129-10-fw@strlen.de


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0413156e
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -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
+0 −7
Original line number Diff line number Diff line
@@ -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"

+7 −0
Original line number Diff line number Diff line
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
}