diff --git a/bin/tests/system/conf.sh.common b/bin/tests/system/conf.sh.common index 2b965deb83..af4fac1e91 100644 --- a/bin/tests/system/conf.sh.common +++ b/bin/tests/system/conf.sh.common @@ -378,14 +378,14 @@ nextpartpeek() { _search_log() ( msg="$1" file="$2" - nextpart "$file" | grep -F "$msg" > /dev/null + nextpart "$file" | grep -F -e "$msg" > /dev/null ) # _search_log_peek: look for message $1 in file $2 with nextpartpeek(). _search_log_peek() ( msg="$1" file="$2" - nextpartpeek "$file" | grep -F "$msg" > /dev/null + nextpartpeek "$file" | grep -F -e "$msg" > /dev/null ) # wait_for_log: wait until message $2 in file $3 appears. Bail out after diff --git a/bin/tests/system/padding/clean.sh b/bin/tests/system/padding/clean.sh index a6e557f71f..b75a3e1c46 100644 --- a/bin/tests/system/padding/clean.sh +++ b/bin/tests/system/padding/clean.sh @@ -11,6 +11,7 @@ rm -f dig.out.* rm -f ns*/named.memstats rm -f ns*/named.run rm -f ns*/named.stats +rm -f ns*/named.stats.prev rm -f ns*/named.lock rm -f ns*/named.conf rm -f ns*/managed-keys.bind* diff --git a/bin/tests/system/padding/setup.sh b/bin/tests/system/padding/setup.sh index 607a341724..2252b7f0f8 100644 --- a/bin/tests/system/padding/setup.sh +++ b/bin/tests/system/padding/setup.sh @@ -12,7 +12,11 @@ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh +$SHELL ./clean.sh + copy_setports ns1/named.conf.in ns1/named.conf copy_setports ns2/named.conf.in ns2/named.conf copy_setports ns3/named.conf.in ns3/named.conf copy_setports ns4/named.conf.in ns4/named.conf + +touch ns2/named.stats diff --git a/bin/tests/system/padding/tests.sh b/bin/tests/system/padding/tests.sh index 5ea90fb401..52b60c5a03 100644 --- a/bin/tests/system/padding/tests.sh +++ b/bin/tests/system/padding/tests.sh @@ -36,8 +36,11 @@ status=`expr $status + $ret` echo_i "checking that dig added padding ($n)" ret=0 n=`expr $n + 1` +nextpart ns2/named.stats > /dev/null $RNDCCMD 10.53.0.2 stats -grep "EDNS padding option received" ns2/named.stats > /dev/null || ret=1 +wait_for_log_peek 5 "--- Statistics Dump ---" ns2/named.stats || ret=1 +nextpart ns2/named.stats | grep "EDNS padding option received" > /dev/null || ret=1 + if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -88,28 +91,30 @@ status=`expr $status + $ret` echo_i "checking that a TCP and padding server config enables padding ($n)" ret=0 n=`expr $n + 1` +nextpart ns2/named.stats > /dev/null $RNDCCMD 10.53.0.2 stats -opad=`grep "EDNS padding option received" ns2/named.stats | \ - tail -1 | awk '{ print $1}'` +wait_for_log_peek 5 "--- Statistics Dump ---" ns2/named.stats || ret=1 +opad=`nextpart ns2/named.stats | awk '/EDNS padding option received/ { print $1}'` $DIG $DIGOPTS foo.example @10.53.0.3 > dig.out.test$n $RNDCCMD 10.53.0.2 stats -npad=`grep "EDNS padding option received" ns2/named.stats | \ - tail -1 | awk '{ print $1}'` -if [ "$opad" -eq "$npad" ]; then ret=1; fi +wait_for_log_peek 5 "--- Statistics Dump ---" ns2/named.stats || ret=1 +npad=`nextpart ns2/named.stats | awk '/EDNS padding option received/ { print $1}'` +if [ "$opad" -eq "$npad" ]; then echo_i "error: opad ($opad) == npad ($npad)"; ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` echo_i "checking that a padding server config should enforce TCP ($n)" ret=0 n=`expr $n + 1` +nextpart ns2/named.stats > /dev/null $RNDCCMD 10.53.0.2 stats -opad=`grep "EDNS padding option received" ns2/named.stats | \ - tail -1 | awk '{ print $1}'` +wait_for_log_peek 5 "--- Statistics Dump ---" ns2/named.stats || ret=1 +opad=`nextpart ns2/named.stats | awk '/EDNS padding option received/ { print $1}'` $DIG $DIGOPTS foo.example @10.53.0.4 > dig.out.test$n $RNDCCMD 10.53.0.2 stats -npad=`grep "EDNS padding option received" ns2/named.stats | \ - tail -1 | awk '{ print $1}'` -if [ "$opad" -ne "$npad" ]; then ret=1; fi +wait_for_log_peek 5 "--- Statistics Dump ---" ns2/named.stats || ret=1 +npad=`nextpart ns2/named.stats | awk '/EDNS padding option received/ { print $1}'` +if [ "$opad" -ne "$npad" ]; then echo_i "error: opad ($opad) != npad ($npad)"; ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret`