tests.sh revision 5e501f3a876e65a384a70b0ce1168a04a36b9d06
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver#!/bin/sh
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# Copyright (C) 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Permission to use, copy, modify, and/or distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# purpose with or without fee is hereby granted, provided that the above
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# copyright notice and this permission notice appear in all copies.
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver#
f97d56e757b9a293ffbaa915ca4d792ae84ba85aTinderbox User# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
f97d56e757b9a293ffbaa915ca4d792ae84ba85aTinderbox User# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# PERFORMANCE OF THIS SOFTWARE.
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# $Id: tests.sh,v 1.14 2012/02/15 00:50:59 marka Exp $
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon SchryverSYSTEMTESTTOP=..
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver. $SYSTEMTESTTOP/conf.sh
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryverisraw () {
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt perl -e 'binmode STDIN;
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver read(STDIN, $input, 8);
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver ($style, $version) = unpack("NN", $input);
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver exit 1 if ($style != 2 || $version > 1);' < $1
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Hunt return $?
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Hunt}
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Hunt
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryverrawversion () {
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt perl -e 'binmode STDIN;
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver read(STDIN, $input, 8);
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver if (length($input) < 8) { print "not raw\n"; exit 0; };
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver ($style, $version) = unpack("NN", $input);
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver print ($style == 2 ? "$version\n" : "not raw\n");' < $1
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver}
4eb998928b9aef0ceda42d7529980d658138698aEvan Hunt
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryversourceserial () {
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt perl -e 'binmode STDIN;
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt read(STDIN, $input, 20);
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt if (length($input) < 20) { print "UNSET\n"; exit; };
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver ($format, $version, $dumptime, $flags, $sourceserial) =
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver unpack("NNNNN", $input);
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver if ($format != 2 || $version < 1) { print "UNSET\n"; exit; };
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver if ($flags & 02) {
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver print $sourceserial . "\n";
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt } else {
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt print "UNSET\n";
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver }' < $1
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt}
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt
94315060c2b0d9deafabe72d6a0482405fd9d377Evan HuntDIGOPTS="+tcp +noauth +noadd +nosea +nostat +noquest +nocomm +nocmd"
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntstatus=0
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntecho "I:checking that master files in raw format loaded"
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntret=0
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntfor zone in example example-explicit example-compat; do
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt for server in 1 2; do
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt for name in ns mx a aaaa cname dname txt rrsig nsec dnskey ds; do
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt $DIG $DIGOPTS $name.$zone. $name @10.53.0.$server -p 5300
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt echo
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt done > dig.out.$zone.$server
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt done
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt $PERL ../digcomp.pl dig.out.$zone.1 dig.out.$zone.2 || ret=1
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntdone
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt[ $ret -eq 0 ] || echo "I:failed"
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntstatus=`expr $status + $ret`
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Hunt
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Huntecho "I:checking raw format versions"
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Huntret=0
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Huntisraw ns1/example.db.raw || ret=1
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Huntisraw ns1/example.db.raw1 || ret=1
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Huntisraw ns1/example.db.compat || ret=1
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Hunt[ "`rawversion ns1/example.db.raw`" = 1 ] || ret=1
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Hunt[ "`rawversion ns1/example.db.raw1`" = 1 ] || ret=1
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Hunt[ "`rawversion ns1/example.db.compat`" = 0 ] || ret=1
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrews[ $ret -eq 0 ] || echo "I:failed"
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrewsstatus=`expr $status + $ret`
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrews
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrewsecho "I:checking source serial numbers"
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrewsret=0
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrews[ "`sourceserial ns1/example.db.raw`" = "UNSET" ] || ret=1
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrews[ "`sourceserial ns1/example.db.serial.raw`" = "3333" ] || ret=1
[ $ret -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
echo "I:waiting for transfers to complete"
for i in 0 1 2 3 4 5 6 7 8 9
do
test -f ns2/transfer.db.raw -a -f ns2/transfer.db.txt && break
sleep 1
done
echo "I:checking that slave was saved in raw format by default"
ret=0
israw ns2/transfer.db.raw || ret=1
[ $ret -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
echo "I:checking that slave was saved in text format when configured"
ret=0
israw ns2/transfer.db.txt && ret=1
[ $ret -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
echo "I:checking that slave formerly in text format is now raw"
for i in 0 1 2 3 4 5 6 7 8 9
do
ret=0
israw ns2/formerly-text.db > /dev/null 2>&1 || ret=1
[ "`rawversion ns2/formerly-text.db`" = 1 ] || ret=1
[ $ret -eq 0 ] && break
sleep 1
done
[ $ret -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
echo "I:checking that large rdatasets loaded"
for i in 0 1 2 3 4 5 6 7 8 9
do
ret=0
for a in a b c
do
$DIG +tcp txt ${a}.large @10.53.0.2 -p 5300 > dig.out
grep "status: NOERROR" dig.out > /dev/null || ret=1
done
[ $ret -eq 0 ] && break
sleep 1
done
[ $ret -eq 0 ] || echo "I:failed"
status=`expr $status + $ret`
echo "I:exit status: $status"
exit $status