diff mbox series

[ipset,1/4] tests: xlate: Test built binary by default

Message ID 20230307135812.25993-2-phil@nwl.cc
State Accepted
Delegated to: Pablo Neira
Headers show
Series Some testsuite improvements | expand

Commit Message

Phil Sutter March 7, 2023, 1:58 p.m. UTC
Testing the host's iptables-translate by default is unintuitive. Since
the ipset-translate symlink is created upon 'make install', add a local
symlink to the repository pointing at a built binary in src/. Using this
by default is consistent with the regular testsuite.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 tests/xlate/ipset-translate | 1 +
 tests/xlate/runtest.sh      | 8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)
 create mode 120000 tests/xlate/ipset-translate
diff mbox series

Patch

diff --git a/tests/xlate/ipset-translate b/tests/xlate/ipset-translate
new file mode 120000
index 0000000000000..91980c18bb040
--- /dev/null
+++ b/tests/xlate/ipset-translate
@@ -0,0 +1 @@ 
+../../src/ipset
\ No newline at end of file
diff --git a/tests/xlate/runtest.sh b/tests/xlate/runtest.sh
index a2a02c05d7573..6a2f80c0d9e61 100755
--- a/tests/xlate/runtest.sh
+++ b/tests/xlate/runtest.sh
@@ -6,14 +6,10 @@  if [ ! -x "$DIFF" ] ; then
 	exit 1
 fi
 
-IPSET_XLATE=$(which ipset-translate)
-if [ ! -x "$IPSET_XLATE" ] ; then
-	echo "ERROR: ipset-translate is not installed yet"
-	exit 1
-fi
+ipset_xlate=${IPSET_XLATE_BIN:-$(dirname $0)/ipset-translate}
 
 TMP=$(mktemp)
-ipset-translate restore < xlate.t &> $TMP
+$ipset_xlate restore < xlate.t &> $TMP
 if [ $? -ne 0 ]
 then
 	cat $TMP