]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: Fix ipt-restore/0004-restore-race_0 testcase
authorPhil Sutter <phil@nwl.cc>
Tue, 14 May 2019 11:46:00 +0000 (13:46 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 15 May 2019 15:14:40 +0000 (17:14 +0200)
Two issues fixed:

* XTABLES_LIBDIR was set wrong (CWD is not topdir but tests/). Drop the
  export altogether, the testscript does this already.

* $LINES is a variable set by bash, so initial dump sanity check failed
  all the time complaining about a spurious initial dump line count. Use
  $LINES1 instead.

Fixes: 4000b4cf2ea38 ("tests: add test script for race-free restore")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/tests/shell/testcases/ipt-restore/0004-restore-race_0

index 14b910eb373bf47ef779a882137e796d68b56035..a92d18dcee0588b4e9f1bb98391122c0874f8b11 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/bash
 
-export XTABLES_LIBDIR=$(pwd)/extensions
 have_nft=false
 nft -v > /dev/null && have_nft=true
 
@@ -77,12 +76,12 @@ dumpfile=$(mktemp) || exit 1
 
 make_dummy_rules > $dumpfile
 $XT_MULTI iptables-restore -w < $dumpfile
-LINES=$(wc -l < $dumpfile)
+LINES1=$(wc -l < $dumpfile)
 $XT_MULTI iptables-save | grep -v '^#' > $dumpfile
 LINES2=$(wc -l < $dumpfile)
 
-if [ $LINES -ne $LINES2 ]; then
-       echo "Original dump has $LINES, not $LINES2" 1>&2
+if [ $LINES1 -ne $LINES2 ]; then
+       echo "Original dump has $LINES1, not $LINES2" 1>&2
        exit 111
 fi