tests.sh revision bf8267aa453e5d2a735ed732a043b77a0b355b20
d29b2c4438482eb00488be49a1f5d6835f455546ab# Copyright (C) 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
d29b2c4438482eb00488be49a1f5d6835f455546ab# Permission to use, copy, modify, and/or distribute this software for any
d29b2c4438482eb00488be49a1f5d6835f455546ab# purpose with or without fee is hereby granted, provided that the above
d29b2c4438482eb00488be49a1f5d6835f455546ab# copyright notice and this permission notice appear in all copies.
d29b2c4438482eb00488be49a1f5d6835f455546ab# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
d29b2c4438482eb00488be49a1f5d6835f455546ab# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
d29b2c4438482eb00488be49a1f5d6835f455546ab# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
d29b2c4438482eb00488be49a1f5d6835f455546ab# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
d29b2c4438482eb00488be49a1f5d6835f455546ab# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
d29b2c4438482eb00488be49a1f5d6835f455546ab# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
d29b2c4438482eb00488be49a1f5d6835f455546ab# PERFORMANCE OF THIS SOFTWARE.
d29b2c4438482eb00488be49a1f5d6835f455546ab read(STDIN, $input, 8);
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami ($style, $version) = unpack("NN", $input);
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami read(STDIN, $input, 8);
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami ($style, $version) = unpack("NN", $input);
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami read(STDIN, $input, 8);
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami if (length($input) < 8) { print "not raw\n"; exit 0; };
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami ($style, $version) = unpack("NN", $input);
d29b2c4438482eb00488be49a1f5d6835f455546ab print ($style == 2 || $style == 3 ? "$version\n" :
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami read(STDIN, $input, 20);
d29b2c4438482eb00488be49a1f5d6835f455546ab if (length($input) < 20) { print "UNSET\n"; exit; };
d29b2c4438482eb00488be49a1f5d6835f455546ab ($format, $version, $dumptime, $flags, $sourceserial) =
d29b2c4438482eb00488be49a1f5d6835f455546ab unpack("NNNNN", $input);
d29b2c4438482eb00488be49a1f5d6835f455546ab if ($format != 2 || $version < 1) { print "UNSET\n"; exit; };
d29b2c4438482eb00488be49a1f5d6835f455546ab if ($flags & 02) {
55ef6355bc6375ad080b10b10660e3528e2b7e6aab print $sourceserial . "\n";
d29b2c4438482eb00488be49a1f5d6835f455546ab print "UNSET\n";
d29b2c4438482eb00488be49a1f5d6835f455546ab (cd ..; $PERL start.pl --noclean --restart masterformat ns3)
d29b2c4438482eb00488be49a1f5d6835f455546abDIGOPTS="+tcp +noauth +noadd +nosea +nostat +noquest +nocomm +nocmd"
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking that master files in raw format loaded"
d29b2c4438482eb00488be49a1f5d6835f455546ab for name in ns mx a aaaa cname dname txt rrsig nsec dnskey ds; do
d29b2c4438482eb00488be49a1f5d6835f455546ab $DIG $DIGOPTS $name.$zone. $name @10.53.0.$server -p 5300
d29b2c4438482eb00488be49a1f5d6835f455546ab $PERL ../digcomp.pl dig.out.$zone.1 dig.out.$zone.2 || ret=1
d29b2c4438482eb00488be49a1f5d6835f455546ab $PERL ../digcomp.pl dig.out.$zone.1 dig.out.$zone.3 || ret=1
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking raw format versions"
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking source serial numbers"
d29b2c4438482eb00488be49a1f5d6835f455546ab[ "`sourceserial ns1/example.db.raw`" = "UNSET" ] || ret=1
d29b2c4438482eb00488be49a1f5d6835f455546ab[ "`sourceserial ns1/example.db.serial.raw`" = "3333" ] || ret=1
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:waiting for transfers to complete"
d29b2c4438482eb00488be49a1f5d6835f455546ab test -f ns2/transfer.db.raw -a -f ns2/transfer.db.txt && break
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking that slave was saved in raw format by default"
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking that slave was saved in text format when configured"
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking that slave formerly in text format is now raw"
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking that large rdatasets loaded"
d29b2c4438482eb00488be49a1f5d6835f455546abfor a in a b c
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking format transitions: text->raw->fast->text"
d29b2c4438482eb00488be49a1f5d6835f455546ab./named-compilezone -D -f text -F text -o baseline.txt example.nil ns1/example.db > /dev/null
d29b2c4438482eb00488be49a1f5d6835f455546ab./named-compilezone -D -f text -F raw -o raw.1 example.nil baseline.txt > /dev/null
d29b2c4438482eb00488be49a1f5d6835f455546ab./named-compilezone -D -f raw -F fast -o fast.1 example.nil raw.1 > /dev/null
d29b2c4438482eb00488be49a1f5d6835f455546ab./named-compilezone -D -f fast -F text -o text.1 example.nil fast.1 > /dev/null
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking format transitions: text->fast->raw->text"
d29b2c4438482eb00488be49a1f5d6835f455546ab./named-compilezone -D -f text -F fast -o fast.2 example.nil baseline.txt > /dev/null
d29b2c4438482eb00488be49a1f5d6835f455546ab./named-compilezone -D -f fast -F raw -o raw.2 example.nil fast.2 > /dev/null
d29b2c4438482eb00488be49a1f5d6835f455546ab./named-compilezone -D -f raw -F text -o text.2 example.nil raw.2 > /dev/null
d29b2c4438482eb00488be49a1f5d6835f455546abecho "I:checking fast format loading with journal file rollforward"
d29b2c4438482eb00488be49a1f5d6835f455546abserver 10.53.0.3 5300
d29b2c4438482eb00488be49a1f5d6835f455546abupdate add newtext.dynamic IN TXT "added text"
d29b2c4438482eb00488be49a1f5d6835f455546abupdate delete aaaa.dynamic
d29b2c4438482eb00488be49a1f5d6835f455546ab$DIG $DIGOPTS @10.53.0.3 -p 5300 newtext.dynamic txt > dig.out.dynamic.3.1
d29b2c4438482eb00488be49a1f5d6835f455546abgrep "added text" dig.out.dynamic.3.1 > /dev/null 2>&1 || ret=1
d29b2c4438482eb00488be49a1f5d6835f455546ab$DIG $DIGOPTS +comm @10.53.0.3 -p 5300 added.dynamic txt > dig.out.dynamic.3.2
d29b2c4438482eb00488be49a1f5d6835f455546abgrep "NXDOMAIN" dig.out.dynamic.3.2 > /dev/null 2>&1 || ret=1
d29b2c4438482eb00488be49a1f5d6835f455546ab# using "rndc halt" ensures that we don't dump the zone file
d29b2c4438482eb00488be49a1f5d6835f455546ab$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 halt 2>&1 | sed 's/^/I:ns3 /'
d29b2c4438482eb00488be49a1f5d6835f455546ab $DIG $DIGOPTS @10.53.0.3 -p 5300 newtext.dynamic txt > dig.out.dynamic.3.3
d29b2c4438482eb00488be49a1f5d6835f455546ab grep "added text" dig.out.dynamic.3.3 > /dev/null 2>&1 || lret=1
d29b2c4438482eb00488be49a1f5d6835f455546ab$DIG $DIGOPTS +comm @10.53.0.3 -p 5300 added.dynamic txt > dig.out.dynamic.3.4
d29b2c4438482eb00488be49a1f5d6835f455546abgrep "NXDOMAIN" dig.out.dynamic.3.4 > /dev/null 2>&1 || ret=1
4f680cc668fa6cf678c531083400ade9a9c7934cAli Bahramiecho "I:checking fast format file dumps correctly"
d29b2c4438482eb00488be49a1f5d6835f455546abserver 10.53.0.3 5300
d29b2c4438482eb00488be49a1f5d6835f455546abupdate add moretext.dynamic IN TXT "more text"
echo "I:exit status: $status"
exit $status