selftests: netfilter: place checktool helper in lib.sh
... so it doesn't have to be repeated everywhere. Signed-off-by: Florian Westphal <fw@strlen.de> Link: https://lore.kernel.org/r/20240411233624.8129-10-fw@strlen.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
0413156eec
commit
10e2ed3fcd
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user