b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews#!/bin/sh
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews#
dce54b9b5cfa450570fe9c11644450aeb3ee89f3Tinderbox User# Copyright (C) 2011, 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/.
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
c8175ece69d986ccd0671bc4d2571b247dfae177Automatic Updater# $Id: tests.sh,v 1.3 2011/03/01 23:48:05 tbox Exp $
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark AndrewsSYSTEMTESTTOP=..
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews. $SYSTEMTESTTOP/conf.sh
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsstatus=0
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsn=0
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsrm -f dig.out.*
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark AndrewsDIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p 5300"
b795de862ba8e75f3b9c56abb9553c28255c8567Mark AndrewsRNDCCMD="$RNDC -s 10.53.0.1 -p 9953 -c ../common/rndc.conf"
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews# Check the example. domain
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsecho "I:checking pre reload zone ($n)"
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsret=0
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews$DIG $DIGOPTS soa database. @10.53.0.1 > dig.out.ns1.test$n || ret=1
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsgrep "hostmaster\.isc\.org" dig.out.ns1.test$n > /dev/null || ret=1
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsn=`expr $n + 1`
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsstatus=`expr $status + $ret`
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewscp ns1/named.conf2 ns1/named.conf
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews$RNDCCMD reload 2>&1 >/dev/null
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsecho "I:checking post reload zone ($n)"
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsret=1
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewstry=0
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewswhile test $try -lt 6
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsdo
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews sleep 1
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews ret=0
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews $DIG $DIGOPTS soa database. @10.53.0.1 > dig.out.ns1.test$n || ret=1
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews grep "marka\.isc\.org" dig.out.ns1.test$n > /dev/null || ret=1
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews try=`expr $try + 1`
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews test $ret -eq 0 && break
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsdone
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsn=`expr $n + 1`
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsstatus=`expr $status + $ret`
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrews
b795de862ba8e75f3b9c56abb9553c28255c8567Mark Andrewsecho "I:exit status: $status"
3635d8f9104e70e141a8f191a0e6c1502ceed2f3Mark Andrews[ $status -eq 0 ] || exit 1