Skip to contentSkip to conversation

tests: Fix ipt-restore/0004-restore-race_0 testcase

PATCH Applied Phil Sutter 2 participants 2 messages May 14, 2019 – May 15, 2019 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: Fix ipt-restore/0004-restore-race_0 testcase

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")
---
 .../tests/shell/testcases/ipt-restore/0004-restore-race_0  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
iptables/tests/shell/testcases/ipt-restore/0004-restore-race_0 +3 -4
index 14b910eb373bf..a92d18dcee058 100755
@@ -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
 
Signature · 1 line
2.21.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Phil Sutter

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.

Applied, thanks.