From c94559480e0ea623fe2d8bfc3ecfe35fd823db06 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Wed, 28 Oct 2020 18:01:49 -0700 Subject: [PATCH] fix a typo in rpz test "tcp-only" was not being tested correctly in the RPZ system test because the option to the "digcmd" function that causes queries to be sent via TCP was misspelled in one case, and was being interpreted as a query name. the "ckresult" function has also been changed to be case sensitive for consistency with "digcmd". (cherry picked from commit 78af071c11d21e2ce18ae2af0b384548c65a47e0) --- bin/tests/system/rpz/tests.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/tests/system/rpz/tests.sh b/bin/tests/system/rpz/tests.sh index 0c512c813f..a8929b9d48 100644 --- a/bin/tests/system/rpz/tests.sh +++ b/bin/tests/system/rpz/tests.sh @@ -246,22 +246,25 @@ clean_result () { # $2=other dig output file ckresult () { #ckalive "$1" "server crashed by 'dig $1'" || return 1 + expr "$1" : 'TCP ' > /dev/null && tcp=1 || tcp=0 + digarg=${1#TCP } + if grep "flags:.* aa .*ad;" $DIGNM; then - setret "'dig $1' AA and AD set;" + setret "'dig $digarg' AA and AD set;" elif grep "flags:.* aa .*ad;" $DIGNM; then - setret "'dig $1' AD set;" + setret "'dig $digarg' AD set;" fi + if $PERL $SYSTEMTESTTOP/digcomp.pl $DIGNM $2 >/dev/null; then - NEED_TCP=`echo "$1" | sed -n -e 's/[Tt][Cc][Pp].*/TCP/p'` - RESULT_TCP=`sed -n -e 's/.*Truncated, retrying in TCP.*/TCP/p' $DIGNM` - if test "$NEED_TCP" != "$RESULT_TCP"; then - setret "'dig $1' wrong; no or unexpected truncation in $DIGNM" + grep -q 'Truncated, retrying in TCP' $DIGNM && trunc=1 || trunc=0 + if [ "$tcp" -ne "$trunc" ]; then + setret "'dig $digarg' wrong; no or unexpected truncation in $DIGNM" return 1 fi clean_result ${DIGNM}* return 0 fi - setret "'dig $1' wrong; diff $DIGNM $2" + setret "'dig $digarg' wrong; diff $DIGNM $2" return 1 } @@ -421,7 +424,7 @@ for mode in native; do nochange a0-1.tld2s srv +auth +dnssec # 30 no write for DNSSEC and no record nxdomain a0-1.tld2s srv +nodnssec # 31 drop a3-8.tld2 any # 32 drop - nochange tcp a3-9.tld2 # 33 tcp-only + nochange TCP a3-9.tld2 # 33 tcp-only here x.servfail <<'EOF' # 34 qname-wait-recurse yes ;; status: SERVFAIL, x EOF