a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews#!/bin/sh
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews#
dce54b9b5cfa450570fe9c11644450aeb3ee89f3Tinderbox User# Copyright (C) 2009, 2010, 2012, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunt# $Id: tests.sh,v 1.7 2010/01/18 19:19:31 each Exp $
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark AndrewsSYSTEMTESTTOP=..
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews. $SYSTEMTESTTOP/conf.sh
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# replace_data dname RR old_data new_data
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data()
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉{
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 if [ $# -ne 4 ]; then
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 echo I:unexpected input for replace_data
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 return 1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 fi
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 _dname=$1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 _rr=$2
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 _olddata=$3
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 _newdata=$4
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 _ret=0
20914534e691755ddcc3b3a5e8d10e910270a3d9Jeremy C. Reed $NSUPDATE -d <<END >> nsupdate.out.test 2>&1 || _ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉server 10.53.0.2 5300
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉update delete ${_dname} 30 ${_rr} ${_olddata}
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉update add ${_dname} 30 ${_rr} ${_newdata}
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉send
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉END
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 if [ $_ret != 0 ]; then
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 echo I:failed to update the test data
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 return 1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 fi
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 return 0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉}
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsstatus=0
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsn=0
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉DIGOPTS="+short +tcp -p 5300"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉DIGOPTS_CD="$DIGOPTS +cd"
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsecho I:Priming cache.
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsret=0
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsexpect="10 mail.example."
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 hostile MX` || ret=1
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewstest "$ans" = "$expect" || ret=1
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewstest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsstatus=`expr $status + $ret`
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsecho I:Checking that bogus additional is not returned with +CD.
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsret=0
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsexpect="10.0.0.2"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 mail.example A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test "$ans" = "$expect" || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉#
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# Prime cache with pending additional records. These should not be promoted
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# to answer.
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉#
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Priming cache (pending additional A and AAAA)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉expect="10 mail.example.com."
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS @10.53.0.4 example.com MX` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test "$ans" = "$expect" || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Replacing pending A"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data mail.example.com. A 192.0.2.2 192.0.2.3 || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Replacing pending AAAA"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data mail.example.com. AAAA 2001:db8::2 2001:db8::3 || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Checking updated data to be returned (without CD)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉expect="192.0.2.3"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS @10.53.0.4 mail.example.com A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test "$ans" = "$expect" || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Checking updated data to be returned (with CD)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉expect="2001:db8::3"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 mail.example.com AAAA` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test "$ans" = "$expect" || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉#
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# Prime cache with a pending answer record. It can be returned (without
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# validation) with +CD.
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉#
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Priming cache (pending answer)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉expect="192.0.2.2"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test "$ans" = "$expect" || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo I:Replacing pending data
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data pending-ok.example.com. A 192.0.2.2 192.0.2.3 || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo I:Confirming cached pending data to be returned with CD
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉expect="192.0.2.2"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test "$ans" = "$expect" || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉#
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# Prime cache with a pending answer record. It should not be returned
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# to no-DNSSEC clients.
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉#
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Priming cache (pending answer)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉expect="192.0.2.102"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ng.example.com A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test "$ans" = "$expect" || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo I:Replacing pending data
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data pending-ng.example.com. A 192.0.2.102 192.0.2.103 || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉status=`expr $status + $ret`
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo I:Confirming updated data returned, not the cached one, without CD
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ret=0
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉expect="192.0.2.103"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS @10.53.0.4 pending-ng.example.com A` || ret=1
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewstest "$ans" = "$expect" || ret=1
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewstest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsstatus=`expr $status + $ret`
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrews
597642c0baaf66172ca44104ed5a18957a969748Evan Hunt#
597642c0baaf66172ca44104ed5a18957a969748Evan Hunt# Try to fool the resolver with an out-of-bailiwick CNAME
597642c0baaf66172ca44104ed5a18957a969748Evan Hunt#
597642c0baaf66172ca44104ed5a18957a969748Evan Huntecho I:Trying to Prime out-of-bailiwick pending answer with CD
597642c0baaf66172ca44104ed5a18957a969748Evan Huntret=0
597642c0baaf66172ca44104ed5a18957a969748Evan Huntexpect="10.10.10.10"
597642c0baaf66172ca44104ed5a18957a969748Evan Huntans=`$DIG $DIGOPTS_CD @10.53.0.4 bad.example. A` || ret=1
597642c0baaf66172ca44104ed5a18957a969748Evan Huntans=`echo $ans | awk '{print $NF}'`
597642c0baaf66172ca44104ed5a18957a969748Evan Hunttest "$ans" = "$expect" || ret=1
597642c0baaf66172ca44104ed5a18957a969748Evan Hunttest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
597642c0baaf66172ca44104ed5a18957a969748Evan Huntstatus=`expr $status + $ret`
597642c0baaf66172ca44104ed5a18957a969748Evan Hunt
597642c0baaf66172ca44104ed5a18957a969748Evan Huntecho I:Confirming the out-of-bailiwick answer is not cached or reused with CD
597642c0baaf66172ca44104ed5a18957a969748Evan Huntret=0
597642c0baaf66172ca44104ed5a18957a969748Evan Huntexpect="10.10.10.10"
597642c0baaf66172ca44104ed5a18957a969748Evan Huntans=`$DIG $DIGOPTS_CD @10.53.0.4 nice.good. A` || ret=1
597642c0baaf66172ca44104ed5a18957a969748Evan Huntans=`echo $ans | awk '{print $NF}'`
597642c0baaf66172ca44104ed5a18957a969748Evan Hunttest "$ans" = "$expect" || ret=1
597642c0baaf66172ca44104ed5a18957a969748Evan Hunttest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
597642c0baaf66172ca44104ed5a18957a969748Evan Huntstatus=`expr $status + $ret`
597642c0baaf66172ca44104ed5a18957a969748Evan Hunt
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunt#
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunt# Make sure the resolver doesn't cache bogus NXDOMAIN
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunt#
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntecho I:Trying to Prime bogus NXDOMAIN
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntret=0
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntexpect="SERVFAIL"
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntans=`$DIG +tcp -p 5300 @10.53.0.4 removed.example.com. A` || ret=1
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntans=`echo $ans | sed 's/^.*status: \([A-Z][A-Z]*\).*$/\1/'`
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunttest "$ans" = "$expect" || ret=1
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunttest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntstatus=`expr $status + $ret`
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunt
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntecho I:Confirming the bogus NXDOMAIN was not cached
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntret=0
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntexpect="SERVFAIL"
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntans=`$DIG +tcp -p 5300 @10.53.0.4 removed.example.com. A` || ret=1
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntans=`echo $ans | sed 's/^.*status: \([A-Z][A-Z]*\).*$/\1/'`
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunttest "$ans" = "$expect" || ret=1
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunttest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntstatus=`expr $status + $ret`
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunt
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsecho "I:exit status: $status"
3635d8f9104e70e141a8f191a0e6c1502ceed2f3Mark Andrews[ $status -eq 0 ] || exit 1