]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: shell: Fix for 'make distcheck'
authorPhil Sutter <phil@nwl.cc>
Tue, 29 Oct 2024 11:21:54 +0000 (12:21 +0100)
committerPhil Sutter <phil@nwl.cc>
Tue, 5 Nov 2024 17:10:24 +0000 (18:10 +0100)
The target performs a "VPATH build", so built binaries are not put into
the same directory tree as the test script itself. For lack of a better
way to detect this, assume $PWD in this situation remains being the
build tree's TLD and check if binaries are present in there.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/tests/shell/run-tests.sh

index 1125690583b466612546facaea3f96386b294030..2ad259c21644ce525fa74e7627c2bd9ec5760cce 100755 (executable)
@@ -87,6 +87,17 @@ if [ "$HOST" != "y" ]; then
        XTABLES_LEGACY_MULTI="$(dirname $0)/../../xtables-legacy-multi"
 
        export XTABLES_LIBDIR=${TESTDIR}/../../../extensions
+
+       # maybe this is 'make distcheck' calling us from a build tree
+       if [ ! -e "$XTABLES_NFT_MULTI" -a \
+            ! -e "$XTABLES_LEGACY_MULTI" -a \
+            -e "./iptables/xtables-nft-multi" -a \
+            -e "./iptables/xtables-legacy-multi" ]; then
+               msg_warn "Running in separate build-tree, using binaries from $PWD/iptables"
+               XTABLES_NFT_MULTI="$PWD/iptables/xtables-nft-multi"
+               XTABLES_LEGACY_MULTI="$PWD/iptables/xtables-legacy-multi"
+               export XTABLES_LIBDIR="$PWD/extensions"
+       fi
 else
        XTABLES_NFT_MULTI="xtables-nft-multi"
        XTABLES_LEGACY_MULTI="xtables-legacy-multi"