0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews#!/bin/sh
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2000, 2001, 2004, 2007, 2012, 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/.
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater# $Id: tests.sh,v 1.6 2007/06/19 23:47:01 tbox Exp $
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
0fc89c4ee660e825ac66774f2d4912cfc396386aMark AndrewsSYSTEMTESTTOP=..
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews. $SYSTEMTESTTOP/conf.sh
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsstatus=0
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsrm -f dig.out.*
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
0fc89c4ee660e825ac66774f2d4912cfc396386aMark AndrewsDIGOPTS="+norec +tcp +noadd +nosea +nostat +noquest +nocmd -p 5300"
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews# Check the example. domain
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews$DIG $DIGOPTS example. @10.53.0.1 soa > dig.out.ns1.test || ret=1
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsecho "I:checking that first zone transfer worked"
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsret=0
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewstry=0
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewswhile test $try -lt 120
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsdo
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews $DIG $DIGOPTS example. @10.53.0.2 soa > dig.out.ns2.test || ret=1
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews if grep SERVFAIL dig.out.ns2.test > /dev/null
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews then
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews try=`expr $try + 1`
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews sleep 1
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews else
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews $PERL ../digcomp.pl dig.out.ns1.test dig.out.ns2.test || ret=1
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews break;
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews fi
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsdone
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsecho "I:try $try"
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsstatus=`expr $status + $ret`
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsecho "I:checking that second zone transfer worked"
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsret=0
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewstry=0
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewswhile test $try -lt 120
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsdo
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews $DIG $DIGOPTS example. @10.53.0.3 soa > dig.out.ns3.test || ret=1
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews if grep SERVFAIL dig.out.ns3.test > /dev/null
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews then
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews try=`expr $try + 1`
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews sleep 1
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews else
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews $PERL ../digcomp.pl dig.out.ns1.test dig.out.ns3.test || ret=1
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews break;
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews fi
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsdone
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsecho "I:try $try"
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsstatus=`expr $status + $ret`
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrews
0fc89c4ee660e825ac66774f2d4912cfc396386aMark Andrewsecho "I:exit status: $status"
3635d8f9104e70e141a8f191a0e6c1502ceed2f3Mark Andrews[ $status -eq 0 ] || exit 1