e7ddc97b4578c281de6559fcd26aa1d68de4531fMark Andrews#!/bin/sh
e7ddc97b4578c281de6559fcd26aa1d68de4531fMark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2000, 2001, 2004, 2007, 2011-2013, 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/.
15a44745412679c30a6d022733925af70a38b715David Lawrence
1ab9944f6b41e6b52da60ff2e328aa49b30e3989Automatic Updater# $Id: tests.sh,v 1.16 2011/11/02 23:46:24 tbox Exp $
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence
e7ddc97b4578c281de6559fcd26aa1d68de4531fMark AndrewsSYSTEMTESTTOP=..
e7ddc97b4578c281de6559fcd26aa1d68de4531fMark Andrews. $SYSTEMTESTTOP/conf.sh
e7ddc97b4578c281de6559fcd26aa1d68de4531fMark Andrews
8d19e0443db60dd84f18715e8f07822ca8591f8aAndreas Gustafssonstatus=0
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsecho "I:check that the stub zone has been saved to disk"
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsfor i in 1 2 3 4 5 6 7 8 9 20
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsdo
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews [ -f ns3/child.example.st ] && break
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews sleep 1
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsdone
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews[ -f ns3/child.example.st ] || { status=1; echo "I:failed"; }
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsfor pass in 1 2
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsdo
e7ddc97b4578c281de6559fcd26aa1d68de4531fMark Andrews
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsecho "I:trying an axfr that should be denied (NOTAUTH) (pass=$pass)"
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrewsret=0
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews$DIG +tcp child.example. @10.53.0.3 axfr -p 5300 > dig.out.ns3 || ret=1
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrewsgrep "; Transfer failed." dig.out.ns3 > /dev/null || ret=1
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews[ $ret = 0 ] || { status=1; echo "I:failed"; }
e7ddc97b4578c281de6559fcd26aa1d68de4531fMark Andrews
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsecho "I:look for stub zone data without recursion (should not be found) (pass=$pass)"
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrewsfor i in 1 2 3 4 5 6 7 8 9
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrewsdo
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews ret=0
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews $DIG +tcp +norec data.child.example. \
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews @10.53.0.3 txt -p 5300 > dig.out.ns3 || ret=1
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews grep "status: NOERROR" dig.out.ns3 > /dev/null || ret=1
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews [ $ret = 0 ] && break
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews sleep 1
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrewsdone
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews$PERL ../digcomp.pl knowngood.dig.out.norec dig.out.ns3 || ret=1
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews[ $ret = 0 ] || { status=1; echo "I:failed"; }
e7ddc97b4578c281de6559fcd26aa1d68de4531fMark Andrews
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsecho "I:look for stub zone data with recursion (should be found) (pass=$pass)"
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrewsret=0
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews$DIG +tcp +noauth +noadd data.child.example. @10.53.0.3 txt -p 5300 > dig.out.ns3 || ret=1
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews$PERL ../digcomp.pl knowngood.dig.out.rec dig.out.ns3 || ret=1
e223d4bb266cdab827c8f8276d577b312a1d4d95Mark Andrews[ $ret = 0 ] || { status=1; echo "I:failed"; }
e7ddc97b4578c281de6559fcd26aa1d68de4531fMark Andrews
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews[ $pass = 1 ] && {
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews echo "I:stopping stub server"
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews $PERL $SYSTEMTESTTOP/stop.pl . ns3
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews echo "I:re-starting stub server"
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews $PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns3
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews}
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrewsdone
c41c261fc7b2ae573fab3675a03a5f1ef099a2eaMark Andrews
1e8c2e72e7d0f48ac37b9b15712e638631b3b619Brian Wellingtonecho "I:exit status: $status"
3635d8f9104e70e141a8f191a0e6c1502ceed2f3Mark Andrews[ $status -eq 0 ] || exit 1