Commit f2c81435 authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

added resolver/ test directory, with a single regression

test for the INSIST(!external) bug
parent 1a92f5c1
#!/usr/bin/perl
#
# Ad hoc name server
#
use IO::File;
use IO::Socket;
use Net::DNS;
use Net::DNS::Packet;
my $sock = IO::Socket::INET->new(LocalAddr => "10.53.0.2",
LocalPort => 5300, Proto => "udp") or die "$!";
my $pidf = new IO::File "ans.pid", "w" or die "cannot write pid file: $!";
print $pidf "$$\n";
$pidf->close;
sub rmpid { unlink "ans.pid"; exit 1; };
$SIG{INT} = \&rmpid;
$SIG{TERM} = \&rmpid;
for (;;) {
$sock->recv($buf, 512);
print "**** request from " , $sock->peerhost, " port ", $sock->peerport, "\n";
my ($packet, $err) = new Net::DNS::Packet(\$buf, 0);
$err and die $err;
print "REQUEST:\n";
$packet->print;
$packet->header->qr(1);
$packet->push("authority", new Net::DNS::RR("below.www.example.com 300 NS ns.below.www.example.com"));
$packet->push("additional", new Net::DNS::RR("ns.below.www.example.com 300 A 10.53.0.3"));
$sock->send($packet->data);
print "RESPONSE:\n";
$packet->print;
print "\n";
}
#!/usr/bin/perl
#
# Ad hoc name server
#
use IO::File;
use IO::Socket;
use Net::DNS;
use Net::DNS::Packet;
my $sock = IO::Socket::INET->new(LocalAddr => "10.53.0.3",
LocalPort => 5300, Proto => "udp") or die "$!";
my $pidf = new IO::File "ans.pid", "w" or die "cannot write pid file: $!";
print $pidf "$$\n";
$pidf->close;
sub rmpid { unlink "ans.pid"; exit 1; };
$SIG{INT} = \&rmpid;
$SIG{TERM} = \&rmpid;
for (;;) {
$sock->recv($buf, 512);
print "**** request from " , $sock->peerhost, " port ", $sock->peerport, "\n";
my ($packet, $err) = new Net::DNS::Packet(\$buf, 0);
$err and die $err;
print "REQUEST:\n";
$packet->print;
$packet->header->qr(1);
$packet->push("answer", new Net::DNS::RR("www.example.com 300 A 1.2.3.4"));
$sock->send($packet->data);
print "RESPONSE:\n";
$packet->print;
print "\n";
}
/*
* Copyright (C) 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/* $Id: named.conf,v 1.1 2000/07/14 23:38:14 gson Exp $ */
options {
query-source address 10.53.0.1;
port 5300;
directory ".";
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 {none;};
recursion yes;
};
zone "." {
type hint;
file "root.hint";
};
; Copyright (C) 2000 Internet Software Consortium.
;
; Permission to use, copy, modify, and distribute this software for any
; purpose with or without fee is hereby granted, provided that the above
; copyright notice and this permission notice appear in all copies.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
; ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
; OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
; CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
; DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
; PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
; ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
; SOFTWARE.
; $Id: root.hint,v 1.1 2000/07/14 23:38:14 gson Exp $
$TTL 999999
. IN NS a.root-servers.nil.
a.root-servers.nil. IN A 10.53.0.2
#!/bin/sh
#
# Copyright (C) 2000 Internet Software Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# $Id: prereq.sh,v 1.1 2000/07/14 23:38:13 gson Exp $
if $PERL -e 'use Net::DNS;' 2>/dev/null
then
:
else
echo "I:This test requires the Net::DNS library." >&2
exit 1
fi
#!/bin/sh
#
# Copyright (C) 2000 Internet Software Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# $Id: tests.sh,v 1.1 2000/07/14 23:38:13 gson Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
#
# Perform tests
#
status=0
$DIG +tcp example. dig www.example.com. a @10.53.0.1 -p 5300 >/dev/null || status = 1
echo "I:exit status: $status"
exit $status
......@@ -15,7 +15,7 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# $Id: run.sh,v 1.28 2000/07/14 23:16:45 gson Exp $
# $Id: run.sh,v 1.29 2000/07/14 23:38:09 gson Exp $
#
# Run a system test.
......@@ -54,9 +54,22 @@ $PERL testsock.pl || {
echo "R:UNTESTED" >&2;
echo "E:$test:`date`" >&2;
exit 0;
}
# Check for test-specific prerequisited.
if
test -f $test/prereq.sh &&
( cd $test && sh prereq.sh "$@" )
then
: prereqs ok
else
echo "I:Prerequisites for $test missing, skipping test." >&2
echo "R:UNTESTED" >&2
echo "E:$test:`date`" >&2
exit 0
fi
# Set up any dynamically generated test data
if test -f $test/setup.sh
then
......
......@@ -15,7 +15,7 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# $Id: start.sh,v 1.26 2000/07/10 23:05:51 bwelling Exp $
# $Id: start.sh,v 1.27 2000/07/14 23:38:10 gson Exp $
#
# Start name servers for running system tests.
......@@ -112,6 +112,39 @@ do
) || exit 1
done
for d in ans*
do
(
if test ! -d $d
then
break
fi
cd $d
rm -f ans.run &&
if test -f ans.pid
then
if kill -0 `cat ans.pid` 2>/dev/null
then
echo "$0: ans pid `cat ans.pid` still running" >&2
exit 1
else
rm -f ans.pid
fi
fi
$PERL ./ans.pl > ans.run 2>&1 &
x=1
while test ! -f ans.pid
do
x=`expr $x + 1`
if [ $x = 5 ]; then
echo "I:Couldn't start ans $d"
exit 1
fi
sleep 1
done
) || exit 1
done
# Make sure all of the servers are up.
status=0
......
......@@ -15,7 +15,7 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# $Id: stop.sh,v 1.13 2000/07/12 17:59:08 bwelling Exp $
# $Id: stop.sh,v 1.14 2000/07/14 23:38:12 gson Exp $
#
# Stop name servers.
......@@ -53,6 +53,19 @@ do
fi
done
for d in ans*
do
pidfile="$d/ans.pid"
if [ -f $pidfile ]; then
kill -TERM `cat $pidfile` > /dev/null 2>&1
if [ $? != 0 ]; then
echo "I:$d died before a SIGTERM was sent"
status=`expr $status + 1`
rm -f $pidfile
fi
fi
done
sleep 5
for d in ns*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment