tests.sh revision 5e501f3a876e65a384a70b0ce1168a04a36b9d06
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver# Copyright (C) 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
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.
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# $Id: tests.sh,v 1.14 2012/02/15 00:50:59 marka Exp $
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver read(STDIN, $input, 8);
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver ($style, $version) = unpack("NN", $input);
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver exit 1 if ($style != 2 || $version > 1);' < $1
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
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 print "UNSET\n";
94315060c2b0d9deafabe72d6a0482405fd9d377Evan HuntDIGOPTS="+tcp +noauth +noadd +nosea +nostat +noquest +nocomm +nocmd"
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntecho "I:checking that master files in raw format loaded"
94315060c2b0d9deafabe72d6a0482405fd9d377Evan Huntfor zone in example example-explicit example-compat; 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 $PERL ../digcomp.pl dig.out.$zone.1 dig.out.$zone.2 || ret=1
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Huntecho "I:checking raw format versions"
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Hunt[ "`rawversion ns1/example.db.raw1`" = 1 ] || ret=1
06e0d6bb126e9986f29036e671b59f48b1d2efbcEvan Hunt[ "`rawversion ns1/example.db.compat`" = 0 ] || ret=1
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrewsecho "I:checking source serial numbers"
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrews[ "`sourceserial ns1/example.db.raw`" = "UNSET" ] || ret=1
ac5ed748602c890d596bed07b0b23b8b5f42b2f6Mark Andrews[ "`sourceserial ns1/example.db.serial.raw`" = "3333" ] || ret=1
for a in a b c
echo "I:exit status: $status"
exit $status