summaryrefslogtreecommitdiffstats
path: root/tests/xlate/runtest.sh
blob: 6a2f80c0d9e611d1c1dc00a85169c6fd62c66a09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

DIFF=$(which diff)
if [ ! -x "$DIFF" ] ; then
	echo "ERROR: missing diff"
	exit 1
fi

ipset_xlate=${IPSET_XLATE_BIN:-$(dirname $0)/ipset-translate}

TMP=$(mktemp)
$ipset_xlate restore < xlate.t &> $TMP
if [ $? -ne 0 ]
then
	cat $TMP
	echo -e "[\033[0;31mERROR\033[0m] failed to run ipset-translate"
	exit 1
fi
${DIFF} -u xlate.t.nft $TMP
if [ $? -eq 0 ]
then
	echo -e "[\033[0;32mOK\033[0m] tests are fine!"
else
	echo -e "[\033[0;31mERROR\033[0m] unexpected ipset to nftables translation"
fi