diff --git a/bin/tests/virtual-time/Makefile.in b/bin/tests/virtual-time/Makefile.in deleted file mode 100644 index bd51ce9890..0000000000 --- a/bin/tests/virtual-time/Makefile.in +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -TARGETS = libvtwrapper.so -SRCS = vtwrapper.c -CFLAGS += -fPIC -LDFLAGS = -LIBS = - -all: libvtwrapper.so - -.SUFFIXES: .c .o - -.c.o: - ${CC} ${CFLAGS} -c $< - -libvtwrapper.so: vtwrapper.o - ${CC} ${CFLAGS} ${LDFLAGS} -nostdlib -export-dynamic -shared -o $@ vtwrapper.o ${LIBS} - -clean distclean:: - rm -f ${TARGETS} *.o - -SUBDIRS = - -test: - if test -f ./runall.sh; then sh ./runall.sh; fi - -testclean clean distclean:: - if test -f ./cleanall.sh; then sh ./cleanall.sh; fi - -distclean:: - rm -f conf.sh diff --git a/bin/tests/virtual-time/README b/bin/tests/virtual-time/README deleted file mode 100644 index a58940fbd7..0000000000 --- a/bin/tests/virtual-time/README +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (C) Internet Systems Consortium, Inc. ("ISC") - -See COPYRIGHT in the source root or http://isc.org/copyright.html for terms. - -This is copied from ../system. - -This test suite uses a virtual time, gettimeofday(), select(), -poll(), kevent() and epoll_wait() Unix system calls are redirected: -gettimeofday() returns a date in virtual/exponentially inflated -delay from an epoch, select(), poll(), kevent() and epoll_wait() -timeouts are deflated down to at least 10ms. - -These tests depends on LD_PRELOAD being supported by the runtime -loader. - -Beware BIND clock uses unsigned integer, in 22 seconds isc_time_now() -overflows and breaks assertions. Note 22 real seconds is 136 virtual -years... diff --git a/bin/tests/virtual-time/autosign-ksk/clean.sh b/bin/tests/virtual-time/autosign-ksk/clean.sh deleted file mode 100644 index 5fd766ee9b..0000000000 --- a/bin/tests/virtual-time/autosign-ksk/clean.sh +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Clean up after virtual time tests. -# -rm -f */K* */dsset-* */*.signed */*.jnl */tmp* -rm -f dig.out.* -rm -f random.data* -rm -f */named.memstats -rm -f */*vtwrapper.* -rm -f ns1/example.db -rm -f ns1/keyname -rm -f ns*/named.lock diff --git a/bin/tests/virtual-time/autosign-ksk/ns1/example.db.in b/bin/tests/virtual-time/autosign-ksk/ns1/example.db.in deleted file mode 100644 index c61ebd38cf..0000000000 --- a/bin/tests/virtual-time/autosign-ksk/ns1/example.db.in +++ /dev/null @@ -1,21 +0,0 @@ -; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -; -; This Source Code Form is subject to the terms of the Mozilla Public -; License, v. 2.0. If a copy of the MPL was not distributed with this -; file, You can obtain one at http://mozilla.org/MPL/2.0/. -; -; See the COPYRIGHT file distributed with this work for additional -; information regarding copyright ownership. - -$TTL 60 ; 1 mn (to avoid to delay activation with ttl > prepublish) -@ IN SOA ns root ( - 2000042100 ; serial - 600 ; refresh - 600 ; retry - 12000 ; expire - 600 ; minimum - ) - NS ns -ns A 10.53.0.1 - -txt TXT "recursed" diff --git a/bin/tests/virtual-time/autosign-ksk/ns1/named.conf b/bin/tests/virtual-time/autosign-ksk/ns1/named.conf deleted file mode 100644 index 141ce62a3d..0000000000 --- a/bin/tests/virtual-time/autosign-ksk/ns1/named.conf +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -controls { /* empty */ }; - -options { - query-source address 10.53.0.1; - notify-source 10.53.0.1; - transfer-source 10.53.0.1; - port 5300; - pid-file "named.pid"; - listen-on { 10.53.0.1; }; - listen-on-v6 { none; }; - recursion no; - notify no; - dnssec-enable yes; - dnssec-validation yes; - sig-validity-interval 20; -}; - -key rndc_key { - secret "1234abcd8765"; - algorithm hmac-md5; -}; - -controls { - inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; }; -}; - -zone "." { - type master; - file "root.db"; -}; - -zone "example." { - type master; - file "example.db.signed"; - allow-query { any; }; - allow-update { any; }; - auto-dnssec maintain; -}; - diff --git a/bin/tests/virtual-time/autosign-ksk/ns1/root.db b/bin/tests/virtual-time/autosign-ksk/ns1/root.db deleted file mode 100644 index d2c6cd4850..0000000000 --- a/bin/tests/virtual-time/autosign-ksk/ns1/root.db +++ /dev/null @@ -1,23 +0,0 @@ -; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -; -; This Source Code Form is subject to the terms of the Mozilla Public -; License, v. 2.0. If a copy of the MPL was not distributed with this -; file, You can obtain one at http://mozilla.org/MPL/2.0/. -; -; See the COPYRIGHT file distributed with this work for additional -; information regarding copyright ownership. - -$TTL 300 -. IN SOA gson.nominum.com. a.root.servers.nil. ( - 2000082401 ; serial - 1800 ; refresh (30 minutes) - 1800 ; retry (30 minutes) - 1814400 ; expire (3 weeks) - 3600 ; minimum (1 hour) - ) -. NS a.root-servers.nil. -a.root-servers.nil. A 10.53.0.1 - -example NS ns.example -ns.example A 10.53.0.1 - diff --git a/bin/tests/virtual-time/autosign-ksk/ns1/sign.sh b/bin/tests/virtual-time/autosign-ksk/ns1/sign.sh deleted file mode 100644 index a1ee51d2e4..0000000000 --- a/bin/tests/virtual-time/autosign-ksk/ns1/sign.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -e -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -SYSTEMTESTTOP=../.. -. $SYSTEMTESTTOP/conf.sh - -zone=example. -infile=example.db.in -zonefile=example.db - -zskname=`$KEYGEN -q -a RSASHA1 -b 768 -n zone $zone` -kskname=`$KEYGEN -q -a RSASHA1 -b 1024 -f KSK -n zone $zone` - -cat $infile $zskname.key $kskname.key > $zonefile - -$SIGNER -P -e +1000d -o $zone $zonefile > /dev/null - -# ksk -keyname=`$KEYGEN -q -a RSASHA1 -b 1024 -n zone \ - -f KSK -P +20 -A +1h -R +6h -I +1d -D +1mo $zone` - -echo $keyname > keyname diff --git a/bin/tests/virtual-time/autosign-ksk/ns1/wrap.sh b/bin/tests/virtual-time/autosign-ksk/ns1/wrap.sh deleted file mode 100644 index 9bc15bb2cc..0000000000 --- a/bin/tests/virtual-time/autosign-ksk/ns1/wrap.sh +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Wrapper for named -# - -LD_PRELOAD=../../libvtwrapper.so -export LD_PRELOAD - -exec $* diff --git a/bin/tests/virtual-time/autosign-ksk/setup.sh b/bin/tests/virtual-time/autosign-ksk/setup.sh deleted file mode 100644 index 504e997652..0000000000 --- a/bin/tests/virtual-time/autosign-ksk/setup.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -e -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh -. ./clean.sh - -cd ns1 && sh sign.sh - diff --git a/bin/tests/virtual-time/autosign-ksk/tests.sh b/bin/tests/virtual-time/autosign-ksk/tests.sh deleted file mode 100644 index 8588b0f579..0000000000 --- a/bin/tests/virtual-time/autosign-ksk/tests.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -status=0 -n=0 - -DIGOPTS="+noadd +nosea +nostat +nocmd +noauth +dnssec -p 5300" - -ksk=ns1/`cat ns1/keyname`.key -kskpat=`awk '/DNSKEY/ { print $8 }' $ksk` -kskid=`sed 's/^Kexample\.+005+0*//' < ns1/keyname` -rkskid=`expr \( $kskid + 128 \) \% 65536` - -echo "I:checking for KSK not yet published ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 -# Note - this is looking for failure, hence the && -tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null && ret=1 -n=`expr $n + 1` -if [ $ret != 0 ]; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 5s real, 55s virtual, P +20 -sleep 4 - -echo "I:checking for KSK published but not yet active ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 -tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1 -# Note - this is looking for failure, hence the && -grep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 10s real, 2h15mn virtual, A +1h -sleep 5 - -echo "I:checking for KSK active ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 -tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1 -grep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null || ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 11s real, 6h7,m virtual, R +6h -sleep 1 - -echo "I:checking for KSK revoked ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 -tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1 -awk 'BEGIN { $noksk=1 } \ -/DNSKEY/ { $5==385 && $noksk=0 } \ -END { exit $noksk }' < dig.out.ns1.test$n > /dev/null || ret=1 -# Note - this is looking for failure, hence the && -grep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1 -grep 'RRSIG.*'" $rkskid "'example\. ' dig.out.ns1.test$n > /dev/null || ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 13s real, 45h virtual, I +1d -sleep 2 - -echo "I:checking for KSK retired but not yet deleted ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 -tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 17s real, 103d virtual, D +1mo -sleep 4 - -echo "I:checking for KSK deleted ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 -# Note - this is looking for failure, hence the && -tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null && ret=1 -# Note - this is looking for failure, hence the && -grep 'RRSIG.*'" $rkskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -echo "I:exit status: $status" -exit $status diff --git a/bin/tests/virtual-time/autosign-zsk/clean.sh b/bin/tests/virtual-time/autosign-zsk/clean.sh deleted file mode 100644 index 5fd766ee9b..0000000000 --- a/bin/tests/virtual-time/autosign-zsk/clean.sh +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Clean up after virtual time tests. -# -rm -f */K* */dsset-* */*.signed */*.jnl */tmp* -rm -f dig.out.* -rm -f random.data* -rm -f */named.memstats -rm -f */*vtwrapper.* -rm -f ns1/example.db -rm -f ns1/keyname -rm -f ns*/named.lock diff --git a/bin/tests/virtual-time/autosign-zsk/ns1/example.db.in b/bin/tests/virtual-time/autosign-zsk/ns1/example.db.in deleted file mode 100644 index c61ebd38cf..0000000000 --- a/bin/tests/virtual-time/autosign-zsk/ns1/example.db.in +++ /dev/null @@ -1,21 +0,0 @@ -; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -; -; This Source Code Form is subject to the terms of the Mozilla Public -; License, v. 2.0. If a copy of the MPL was not distributed with this -; file, You can obtain one at http://mozilla.org/MPL/2.0/. -; -; See the COPYRIGHT file distributed with this work for additional -; information regarding copyright ownership. - -$TTL 60 ; 1 mn (to avoid to delay activation with ttl > prepublish) -@ IN SOA ns root ( - 2000042100 ; serial - 600 ; refresh - 600 ; retry - 12000 ; expire - 600 ; minimum - ) - NS ns -ns A 10.53.0.1 - -txt TXT "recursed" diff --git a/bin/tests/virtual-time/autosign-zsk/ns1/named.conf b/bin/tests/virtual-time/autosign-zsk/ns1/named.conf deleted file mode 100644 index 94e91267b4..0000000000 --- a/bin/tests/virtual-time/autosign-zsk/ns1/named.conf +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -controls { /* empty */ }; - -options { - query-source address 10.53.0.1; - notify-source 10.53.0.1; - transfer-source 10.53.0.1; - port 5300; - pid-file "named.pid"; - listen-on { 10.53.0.1; }; - listen-on-v6 { none; }; - recursion no; - notify no; - dnssec-enable yes; - dnssec-validation yes; - sig-validity-interval 2; -}; - -key rndc_key { - secret "1234abcd8765"; - algorithm hmac-md5; -}; - -controls { - inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; }; -}; - -zone "." { - type master; - file "root.db"; -}; - -zone "example." { - type master; - file "example.db.signed"; - allow-query { any; }; - allow-update { any; }; - auto-dnssec maintain; -}; - diff --git a/bin/tests/virtual-time/autosign-zsk/ns1/root.db b/bin/tests/virtual-time/autosign-zsk/ns1/root.db deleted file mode 100644 index d2c6cd4850..0000000000 --- a/bin/tests/virtual-time/autosign-zsk/ns1/root.db +++ /dev/null @@ -1,23 +0,0 @@ -; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -; -; This Source Code Form is subject to the terms of the Mozilla Public -; License, v. 2.0. If a copy of the MPL was not distributed with this -; file, You can obtain one at http://mozilla.org/MPL/2.0/. -; -; See the COPYRIGHT file distributed with this work for additional -; information regarding copyright ownership. - -$TTL 300 -. IN SOA gson.nominum.com. a.root.servers.nil. ( - 2000082401 ; serial - 1800 ; refresh (30 minutes) - 1800 ; retry (30 minutes) - 1814400 ; expire (3 weeks) - 3600 ; minimum (1 hour) - ) -. NS a.root-servers.nil. -a.root-servers.nil. A 10.53.0.1 - -example NS ns.example -ns.example A 10.53.0.1 - diff --git a/bin/tests/virtual-time/autosign-zsk/ns1/sign.sh b/bin/tests/virtual-time/autosign-zsk/ns1/sign.sh deleted file mode 100644 index fe0d23f04a..0000000000 --- a/bin/tests/virtual-time/autosign-zsk/ns1/sign.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -e -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -SYSTEMTESTTOP=../.. -. $SYSTEMTESTTOP/conf.sh - -zone=example. -infile=example.db.in -zonefile=example.db - -zskname=`$KEYGEN -q -a RSASHA1 -b 768 -n zone $zone` -kskname=`$KEYGEN -q -a RSASHA1 -b 1024 -f KSK -n zone $zone` - -cat $infile $zskname.key $kskname.key > $zonefile - -$SIGNER -P -e +1000d -o $zone $zonefile > /dev/null - -# zsk, no -R -keyname=`$KEYGEN -q -a RSASHA1 -b 768 -n zone \ - -P +20 -A +1h -I +1d -D +1mo $zone` - -echo $keyname > keyname diff --git a/bin/tests/virtual-time/autosign-zsk/ns1/wrap.sh b/bin/tests/virtual-time/autosign-zsk/ns1/wrap.sh deleted file mode 100644 index 9bc15bb2cc..0000000000 --- a/bin/tests/virtual-time/autosign-zsk/ns1/wrap.sh +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Wrapper for named -# - -LD_PRELOAD=../../libvtwrapper.so -export LD_PRELOAD - -exec $* diff --git a/bin/tests/virtual-time/autosign-zsk/setup.sh b/bin/tests/virtual-time/autosign-zsk/setup.sh deleted file mode 100644 index 504e997652..0000000000 --- a/bin/tests/virtual-time/autosign-zsk/setup.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -e -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh -. ./clean.sh - -cd ns1 && sh sign.sh - diff --git a/bin/tests/virtual-time/autosign-zsk/tests.sh b/bin/tests/virtual-time/autosign-zsk/tests.sh deleted file mode 100644 index e71af8fcbd..0000000000 --- a/bin/tests/virtual-time/autosign-zsk/tests.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -status=0 -n=0 - -DIGOPTS="+noadd +nosea +nostat +nocmd +noauth +dnssec -p 5300" - -zsk=ns1/`cat ns1/keyname`.key -zskpat=`awk '/DNSKEY/ { print $8 }' $zsk` -zskid=`sed 's/^Kexample\.+005+0*//' < ns1/keyname` - -echo "I:checking for ZSK not yet published ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 -# Note - this is looking for failure, hence the && -tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null && ret=1 -$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 -# Note - this is looking for failure, hence the && -grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null && ret=1 -n=`expr $n + 1` -if [ $ret != 0 ]; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 5s real, 55s virtual, P +20 -sleep 4 - -echo "I:checking for ZSK published but not yet active ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 -tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null || ret=1 -# Note - this is looking for failure, hence the && -$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 -grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null && ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 10s real, 2h15mn virtual, A +1h -sleep 5 - -echo "I:checking for ZSK active ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 -tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null || ret=1 -$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 -grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null || ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 13s real, 45h virtual, I +1d -sleep 3 - -echo "I:checking for ZSK retired but not yet deleted ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 -tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null || ret=1 -# Note - this is looking for failure, hence the && -$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 -grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null && ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -# 17s real, 103d virtual, D +1mo -sleep 4 - -echo "I:checking for ZSK deleted ($n)" -ret=0 -$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 -# Note - this is looking for failure, hence the && -tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null && ret=1 -# Note - this is looking for failure, hence the && -$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 -grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null && ret=1 -n=`expr $n + 1` -if [ $ret != 0 ] ; then echo "I:failed"; fi -status=`expr $status + $ret` - -echo "I:exit status: $status" -exit $status diff --git a/bin/tests/virtual-time/cleanall.sh b/bin/tests/virtual-time/cleanall.sh deleted file mode 100644 index 9bc5eea110..0000000000 --- a/bin/tests/virtual-time/cleanall.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Clean up after system tests. -# - -SYSTEMTESTTOP=. -. $SYSTEMTESTTOP/conf.sh - - -find . -type f \( \ - -name 'K*' -o -name '*~' -o -name '*.core' -o -name '*.log' \ - -o -name '*.pid' -o -name '*.keyset' -o -name named.run \ - -o -name ans.run \) -print | xargs rm -f - -status=0 - -for d in $SUBDIRS -do - test ! -f $d/clean.sh || ( cd $d && sh clean.sh ) -done diff --git a/bin/tests/virtual-time/common/controls.conf b/bin/tests/virtual-time/common/controls.conf deleted file mode 100644 index 021bf861cb..0000000000 --- a/bin/tests/virtual-time/common/controls.conf +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -key rndc_key { - secret "1234abcd8765"; - algorithm hmac-md5; -}; - -controls { - inet 10.53.0.2 port 9953 allow { any; } keys { rndc_key; }; -}; - diff --git a/bin/tests/virtual-time/common/rndc.conf b/bin/tests/virtual-time/common/rndc.conf deleted file mode 100644 index b47ca45ee0..0000000000 --- a/bin/tests/virtual-time/common/rndc.conf +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -options { - default-key "rndc_key"; -}; - -key rndc_key { - algorithm hmac-md5; - secret "1234abcd8765"; -}; diff --git a/bin/tests/virtual-time/common/root.hint b/bin/tests/virtual-time/common/root.hint deleted file mode 100644 index 418ea963fa..0000000000 --- a/bin/tests/virtual-time/common/root.hint +++ /dev/null @@ -1,12 +0,0 @@ -; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -; -; This Source Code Form is subject to the terms of the Mozilla Public -; License, v. 2.0. If a copy of the MPL was not distributed with this -; file, You can obtain one at http://mozilla.org/MPL/2.0/. -; -; See the COPYRIGHT file distributed with this work for additional -; information regarding copyright ownership. - -$TTL 999999 -. IN NS a.root-servers.nil. -a.root-servers.nil. IN A 10.53.0.1 diff --git a/bin/tests/virtual-time/conf.sh.in b/bin/tests/virtual-time/conf.sh.in deleted file mode 100644 index c62a7d69d2..0000000000 --- a/bin/tests/virtual-time/conf.sh.in +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Common configuration data for system tests, to be sourced into -# other shell scripts. -# - -# Find the top of the BIND9 tree. -TOP=${SYSTEMTESTTOP:=.}/../../.. - -# Make it absolute so that it continues to work after we cd. -TOP=`cd $TOP && pwd` - -NAMED=$TOP/bin/named/named -DIG=$TOP/bin/dig/dig -RNDC=$TOP/bin/rndc/rndc -NSUPDATE=$TOP/bin/nsupdate/nsupdate -DDNSCONFGEN=$TOP/bin/confgen/ddns-confgen -KEYGEN=$TOP/bin/dnssec/dnssec-keygen -SIGNER=$TOP/bin/dnssec/dnssec-signzone -REVOKE=$TOP/bin/dnssec/dnssec-revoke -SETTIME=$TOP/bin/dnssec/dnssec-settime -DSFROMKEY=$TOP/bin/dnssec/dnssec-dsfromkey -CHECKZONE=$TOP/bin/check/named-checkzone -CHECKCONF=$TOP/bin/check/named-checkconf - -SUBDIRS="slave autosign-zsk autosign-ksk" - -# PERL will be an empty string if no perl interpreter was found. -PERL=@PERL@ - -export NAMED DIG NSUPDATE KEYGEN SIGNER KEYSIGNER KEYSETTOOL PERL \ - SUBDIRS RNDC CHECKZONE diff --git a/bin/tests/virtual-time/run.sh b/bin/tests/virtual-time/run.sh deleted file mode 100644 index c29d2ed5bc..0000000000 --- a/bin/tests/virtual-time/run.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -SYSTEMTESTTOP=. -. $SYSTEMTESTTOP/conf.sh - -stopservers=true - -case $1 in - --keep) stopservers=false; shift ;; -esac - -test $# -gt 0 || { echo "usage: $0 [--keep] test-directory" >&2; exit 1; } - -test=$1 -shift - -test -d $test || { echo "$0: $test: no such test" >&2; exit 1; } - -echo "S:$test:`date`" >&2 -echo "T:$test:1:A" >&2 -echo "A:Virtual time test $test" >&2 - -if [ x$PERL = x ] -then - echo "I:Perl not available. Skipping test." >&2 - echo "R:UNTESTED" >&2 - echo "E:$test:`date`" >&2 - exit 0; -fi - -$PERL testsock.pl || { - echo "I:Network interface aliases not set up. Skipping test." >&2 - echo "R:UNTESTED" >&2 - echo "E:$test:`date`" >&2 - exit 0; -} - -# Check for test-specific prerequisites. -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 - ( cd $test && sh setup.sh "$@" ) -fi - -# Start name servers running -$PERL start.pl $test || exit 1 - -# Run the tests -( cd $test ; sh tests.sh ) - -status=$? - -if $stopservers -then - : -else - exit $status -fi - -# Shutdown -$PERL stop.pl $test - -status=`expr $status + $?` - -if [ $status != 0 ]; then - echo "R:FAIL" - # Don't clean up - we need the evidence. - find . -name core -exec chmod 0644 '{}' \; -else - echo "R:PASS" - - # Clean up. - if test -f $test/clean.sh - then - ( cd $test && sh clean.sh "$@" ) - fi -fi - -echo "E:$test:`date`" - -exit $status diff --git a/bin/tests/virtual-time/runall.sh b/bin/tests/virtual-time/runall.sh deleted file mode 100644 index 82b26bd4ad..0000000000 --- a/bin/tests/virtual-time/runall.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Run all the virtual time tests. -# - -SYSTEMTESTTOP=. -. $SYSTEMTESTTOP/conf.sh - -$PERL testsock.pl || { - echo "I:Network interface aliases not set up. Skipping tests." >&2; - echo "R:UNTESTED" >&2; - echo "E:virtual-time:`date`" >&2; - exit 0; -} - -status=0 - -for d in $SUBDIRS -do - sh run.sh $d || status=1 -done - -exit $status diff --git a/bin/tests/virtual-time/setup.sh b/bin/tests/virtual-time/setup.sh deleted file mode 100644 index e2db2e55fd..0000000000 --- a/bin/tests/virtual-time/setup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Run a system test. -# - -SYSTEMTESTTOP=. -. $SYSTEMTESTTOP/conf.sh - -test $# -gt 0 || { echo "usage: $0 test-directory" >&2; exit 1; } - -test=$1 -shift - -test -d $test || { echo "$0: $test: no such test" >&2; exit 1; } - -# Set up any dynamically generated test data -if test -f $test/setup.sh -then - ( cd $test && sh setup.sh "$@" ) -fi diff --git a/bin/tests/virtual-time/slave/clean.sh b/bin/tests/virtual-time/slave/clean.sh deleted file mode 100644 index 780e8b2961..0000000000 --- a/bin/tests/virtual-time/slave/clean.sh +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Clean up after virtual time tests. -# -rm -f dig.out.* -rm -f ns1/named.memstats -rm -f ns1/vtwrapper.* -rm -f ns1/example.db -rm -f ns*/named.lock diff --git a/bin/tests/virtual-time/slave/ns1/example.db.in b/bin/tests/virtual-time/slave/ns1/example.db.in deleted file mode 100644 index 9b54373d8a..0000000000 --- a/bin/tests/virtual-time/slave/ns1/example.db.in +++ /dev/null @@ -1,21 +0,0 @@ -; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -; -; This Source Code Form is subject to the terms of the Mozilla Public -; License, v. 2.0. If a copy of the MPL was not distributed with this -; file, You can obtain one at http://mozilla.org/MPL/2.0/. -; -; See the COPYRIGHT file distributed with this work for additional -; information regarding copyright ownership. - -$TTL 300 ; 5 minutes -@ IN SOA ns root ( - 2000042100 ; serial - 600 ; refresh - 600 ; retry - 12000 ; expire - 600 ; minimum - ) - NS ns -ns A 10.53.0.1 - -txt TXT "recursed" diff --git a/bin/tests/virtual-time/slave/ns1/named.conf b/bin/tests/virtual-time/slave/ns1/named.conf deleted file mode 100644 index 5cd39313f2..0000000000 --- a/bin/tests/virtual-time/slave/ns1/named.conf +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -controls { /* empty */ }; - -options { - query-source address 10.53.0.1; - notify-source 10.53.0.1; - transfer-source 10.53.0.1; - port 5300; - pid-file "named.pid"; - listen-on { 10.53.0.1; }; - listen-on-v6 { none; }; - recursion no; - notify no; -}; - -key rndc_key { - secret "1234abcd8765"; - algorithm hmac-md5; -}; - -controls { - inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; }; -}; - -zone "." { - type master; - file "root.db"; -}; - -zone "example." { - type slave; - masters { 10.53.0.111; }; - file "example.db"; -}; - diff --git a/bin/tests/virtual-time/slave/ns1/root.db b/bin/tests/virtual-time/slave/ns1/root.db deleted file mode 100644 index d2c6cd4850..0000000000 --- a/bin/tests/virtual-time/slave/ns1/root.db +++ /dev/null @@ -1,23 +0,0 @@ -; Copyright (C) Internet Systems Consortium, Inc. ("ISC") -; -; This Source Code Form is subject to the terms of the Mozilla Public -; License, v. 2.0. If a copy of the MPL was not distributed with this -; file, You can obtain one at http://mozilla.org/MPL/2.0/. -; -; See the COPYRIGHT file distributed with this work for additional -; information regarding copyright ownership. - -$TTL 300 -. IN SOA gson.nominum.com. a.root.servers.nil. ( - 2000082401 ; serial - 1800 ; refresh (30 minutes) - 1800 ; retry (30 minutes) - 1814400 ; expire (3 weeks) - 3600 ; minimum (1 hour) - ) -. NS a.root-servers.nil. -a.root-servers.nil. A 10.53.0.1 - -example NS ns.example -ns.example A 10.53.0.1 - diff --git a/bin/tests/virtual-time/slave/ns1/wrap.sh b/bin/tests/virtual-time/slave/ns1/wrap.sh deleted file mode 100644 index 9bc15bb2cc..0000000000 --- a/bin/tests/virtual-time/slave/ns1/wrap.sh +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# -# Wrapper for named -# - -LD_PRELOAD=../../libvtwrapper.so -export LD_PRELOAD - -exec $* diff --git a/bin/tests/virtual-time/slave/setup.sh b/bin/tests/virtual-time/slave/setup.sh deleted file mode 100644 index 4b385e8ee4..0000000000 --- a/bin/tests/virtual-time/slave/setup.sh +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -rm -f ns1/example.db -cp ns1/example.db.in ns1/example.db diff --git a/bin/tests/virtual-time/slave/tests.sh b/bin/tests/virtual-time/slave/tests.sh deleted file mode 100644 index 3768910965..0000000000 --- a/bin/tests/virtual-time/slave/tests.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -status=0 - -rm -f dig.out.* - -DIGOPTS="+tcp +noadd +nosea +nostat +nocmd -p 5300" - -echo "I:checking slave expiry" -ret=0 -$DIG $DIGOPTS txt.example. txt @10.53.0.1 > dig.out.before || ret=1 -echo "I:waiting for expiry (10s real, 6h virtual)" -sleep 10 -$DIG $DIGOPTS txt.example. txt @10.53.0.1 > dig.out.after || ret=1 -if [ $ret != 0 ]; then echo "I:failed"; fi -status=`expr $status + $ret` - -ret=0 -grep "status: NOERROR" dig.out.before > /dev/null || ret=1 -if [ $ret -eq 1 ] ; then - echo "I:failed (before)"; status=1 -fi -ret=0 -grep "status: SERVFAIL" dig.out.after > /dev/null || ret=1 -if [ $ret -eq 1 ] ; then - echo "I:failed (after)"; status=1 -fi - -echo "I:exit status: $status" -exit $status diff --git a/bin/tests/virtual-time/start.pl b/bin/tests/virtual-time/start.pl deleted file mode 100644 index 8e29033506..0000000000 --- a/bin/tests/virtual-time/start.pl +++ /dev/null @@ -1,177 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# Framework for starting test servers. -# Based on the type of server specified, check for port availability, remove -# temporary files, start the server, and verify that the server is running. -# If a server is specified, start it. Otherwise, start all servers for test. - -use strict; -use Cwd 'abs_path'; -use Getopt::Long; - -# Option handling -# --noclean test [server [options]] -# -# --noclean - Do not cleanup files in server directory -# test - name of the test directory -# server - name of the server directory -# options - alternate options for the server - -my $usage = "usage: $0 [--noclean] test-directory [server-directory [server-options]]"; -my $noclean; -GetOptions('noclean' => \$noclean); -my $test = $ARGV[0]; -my $server = $ARGV[1]; -my $options = $ARGV[2]; - -if (!$test) { - print "$usage\n"; -} -if (!-d $test) { - print "No test directory: \"$test\"\n"; -} -if ($server && !-d "$test/$server") { - print "No server directory: \"$test/$server\"\n"; -} - -# Global variables -my $topdir = abs_path("$test/.."); -my $testdir = abs_path("$test"); -my $NAMED = $ENV{'NAMED'}; -my $DIG = $ENV{'DIG'}; -my $PERL = $ENV{'PERL'}; - -# Start the server(s) - -if ($server) { - if ($server =~ /^ns/) { - &check_ports($server); - } - &start_server($server, $options); - if ($server =~ /^ns/) { - &verify_server($server); - } -} else { - # Determine which servers need to be started for this test. - opendir DIR, $testdir; - my @files = sort readdir DIR; - closedir DIR; - - my @ns = grep /^ns[0-9]*$/, @files; - - # Start the servers we found. - &check_ports(); - foreach (@ns) { - &start_server($_); - } - foreach (@ns) { - &verify_server($_); - } -} - -# Subroutines - -sub check_ports { - my $server = shift; - my $options = ""; - - if ($server && $server =~ /(\d+)$/) { - $options = "-i $1"; - } - - my $tries = 0; - while (1) { - my $return = system("$PERL $topdir/testsock.pl -p 5300 $options"); - last if ($return == 0); - if (++$tries > 4) { - print "$0: could not bind to server addresses, still running?\n"; - print "I:server sockets not available\n"; - print "R:FAIL\n"; - system("$PERL $topdir/stop.pl $testdir"); # Is this the correct behavior? - exit 1; - } - print "I:Couldn't bind to socket (yet)\n"; - sleep 2; - } -} - -sub start_server { - my $server = shift; - my $options = shift; - - my $cleanup_files; - my $command; - my $pid_file; - - if ($server =~ /^ns/) { - $cleanup_files = "{*.jnl,*.bk,*.st,named.run}"; - $command = "sh wrap.sh "; - $command .= "$NAMED "; - if ($options) { - $command .= "$options"; - } else { - $command .= "-m record,size,mctx "; - $command .= "-T clienttest "; - $command .= "-X named.lock "; - $command .= "-c named.conf -d 99 -g"; - } - $command .= " >named.run 2>&1 &"; - $pid_file = "named.pid"; - } else { - print "I:Unknown server type $server\n"; - print "R:FAIL\n"; - system "$PERL $topdir/stop.pl $testdir"; - exit 1; - } - -# print "I:starting server $server\n"; - - chdir "$testdir/$server"; - - unless ($noclean) { - unlink glob $cleanup_files; - } - - system "$command"; - - my $tries = 0; - while (!-f $pid_file) { - if (++$tries > 14) { - print "I:Couldn't start server $server\n"; - print "R:FAIL\n"; - system "$PERL $topdir/stop.pl $testdir"; - exit 1; - } - sleep 1; - } -} - -sub verify_server { - my $server = shift; - my $n = $server; - $n =~ s/^ns//; - - my $tries = 0; - while (1) { - my $return = system("$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p 5300 version.bind. chaos txt \@10.53.0.$n > dig.out"); - last if ($return == 0); - print `grep ";" dig.out`; - if (++$tries >= 30) { - print "I:no response from $server\n"; - print "R:FAIL\n"; - system("$PERL $topdir/stop.pl $testdir"); - exit 1; - } - sleep 2; - } - unlink "dig.out"; -} diff --git a/bin/tests/virtual-time/start.sh b/bin/tests/virtual-time/start.sh deleted file mode 100644 index 78fb0443d7..0000000000 --- a/bin/tests/virtual-time/start.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -. ./conf.sh -$PERL start.pl "$@" diff --git a/bin/tests/virtual-time/stop.pl b/bin/tests/virtual-time/stop.pl deleted file mode 100644 index b46aa600ab..0000000000 --- a/bin/tests/virtual-time/stop.pl +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# Framework for stopping test servers -# Based on the type of server specified, signal the server to stop, wait -# briefly for it to die, and then kill it if it is still alive. -# If a server is specified, stop it. Otherwise, stop all servers for test. - -use strict; -use Cwd 'abs_path'; - -# Option handling -# [--use-rndc] test [server] -# -# test - name of the test directory -# server - name of the server directory - -my $usage = "usage: $0 [--use-rndc] test-directory [server-directory]"; -my $use_rndc; - -while (@ARGV && $ARGV[0] =~ /^-/) { - my $opt = shift @ARGV; - if ($opt eq '--use-rndc') { - $use_rndc = 1; - } else { - die "$usage\n"; - } -} - -my $test = $ARGV[0]; -my $server = $ARGV[1]; - -my $errors = 0; - -die "$usage\n" unless defined($test); -die "No test directory: \"$test\"\n" unless (-d $test); -die "No server directory: \"$server\"\n" if (defined($server) && !-d "$test/$server"); - -# Global variables -my $testdir = abs_path($test); -my @servers; - - -# Determine which servers need to be stopped. -if (defined $server) { - @servers = ($server); -} else { - local *DIR; - opendir DIR, $testdir or die "$testdir: $!\n"; - my @files = sort readdir DIR; - closedir DIR; - - my @ns = grep /^ns[0-9]*$/, @files; - - push @servers, @ns; -} - - -# Stop the server(s), pass 1: rndc. -if ($use_rndc) { - foreach my $server (grep /^ns/, @servers) { - stop_rndc($server); - } - - wait_for_servers(30, grep /^ns/, @servers); -} - - -# Pass 2: SIGTERM -foreach my $server (@servers) { - stop_signal($server, "TERM"); -} - -wait_for_servers(60, @servers); - -# Pass 3: SIGABRT -foreach my $server (@servers) { - stop_signal($server, "ABRT"); -} - -exit($errors ? 1 : 0); - -# Subroutines - -# Return the full path to a given server's PID file. -sub server_pid_file { - my($server) = @_; - - my $pid_file; - if ($server =~ /^ns/) { - $pid_file = "named.pid"; - } else { - print "I:Unknown server type $server\n"; - exit 1; - } - $pid_file = "$testdir/$server/$pid_file"; -} - -# Read a PID. -sub read_pid { - my($pid_file) = @_; - - local *FH; - my $result = open FH, "< $pid_file"; - if (!$result) { - print "I:$pid_file: $!\n"; - unlink $pid_file; - return; - } - - my $pid = ; - chomp($pid); - return $pid; -} - -# Stop a named process with rndc. -sub stop_rndc { - my($server) = @_; - - return unless ($server =~ /^ns(\d+)$/); - my $ip = "10.53.0.$1"; - - # Ugly, but should work. - system("$ENV{RNDC} -c $testdir/../common/rndc.conf -s $ip -p 9953 stop | sed 's/^/I:$server /'"); - return; -} - -# Stop a server by sending a signal to it. -sub stop_signal { - my($server, $sig) = @_; - - my $pid_file = server_pid_file($server); - return unless -f $pid_file; - - my $pid = read_pid($pid_file); - return unless defined($pid); - - if ($sig eq 'ABRT') { - print "I:$server didn't die when sent a SIGTERM\n"; - $errors++; - } - - my $result = kill $sig, $pid; - if (!$result) { - print "I:$server died before a SIG$sig was sent\n"; - unlink $pid_file; - $errors++; - } - - return; -} - -sub wait_for_servers { - my($timeout, @servers) = @_; - - my @pid_files = grep { defined($_) } - map { server_pid_file($_) } @servers; - - while ($timeout > 0 && @pid_files > 0) { - @pid_files = grep { -f $_ } @pid_files; - sleep 1 if (@pid_files > 0); - $timeout--; - } - - return; -} diff --git a/bin/tests/virtual-time/stop.sh b/bin/tests/virtual-time/stop.sh deleted file mode 100644 index a2ae614d89..0000000000 --- a/bin/tests/virtual-time/stop.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -. ./conf.sh -$PERL ./stop.pl "$@" - diff --git a/bin/tests/virtual-time/testsock.pl b/bin/tests/virtual-time/testsock.pl deleted file mode 100644 index b793baef4a..0000000000 --- a/bin/tests/virtual-time/testsock.pl +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -# Test whether the interfaces on 10.53.0.* are up. - -require 5.001; - -use Socket; -use Getopt::Long; - -my $port = 0; -my $id = 0; -GetOptions("p=i" => \$port, - "i=i" => \$id); - -my @ids; -if ($id != 0) { - @ids = ($id); -} else { - @ids = (1..5); -} - -foreach $id (@ids) { - my $addr = pack("C4", 10, 53, 0, $id); - my $sa = pack_sockaddr_in($port, $addr); - socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname("tcp")) - or die "$0: socket: $!\n"; - setsockopt(SOCK, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)); - - bind(SOCK, $sa) - or die sprintf("$0: bind(%s, %d): $!\n", - inet_ntoa($addr), $port); - close(SOCK); - sleep(1); -} diff --git a/bin/tests/virtual-time/vtwrapper.c b/bin/tests/virtual-time/vtwrapper.c deleted file mode 100644 index 2b40fabc95..0000000000 --- a/bin/tests/virtual-time/vtwrapper.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#ifdef SYS_select -#include -#endif -#ifdef SYS_poll -#include -#endif -#ifdef SYS_kevent -#include -#endif -#ifdef SYS_epoll_wait -#include -#endif - - -#ifdef SYS_gettimeofday -#define VIRTUAL_TIME -#ifdef VIRTUAL_TIME -static struct timeval epoch = { 0, 0 }; -static int _init_called = 0; - -void -_init(void) { - (void)syscall(SYS_gettimeofday, &epoch, NULL); - _init_called = 1; -} - -static void -absolute_inflate(struct timeval *vt, struct timeval *rt) -{ - double d; - - rt->tv_sec = vt->tv_sec; - rt->tv_usec = vt->tv_usec; - - if ((epoch.tv_sec > vt->tv_sec) || - ((epoch.tv_sec == vt->tv_sec) && (epoch.tv_usec > vt->tv_usec))) - return; - - rt->tv_sec -= epoch.tv_sec; - rt->tv_usec -= epoch.tv_usec; - while (rt->tv_usec < 0) { - rt->tv_sec -= 1; - rt->tv_usec += 1000000; - } - - if (rt->tv_sec == 0) - goto done; - - d = (double) (rt->tv_sec - 1); - d += (double) rt->tv_usec / 1000000.; - d = exp(d); - rt->tv_sec = (time_t) d; - d -= (double) rt->tv_sec; - rt->tv_usec = (suseconds_t) (d * 1000000.); - - done: - rt->tv_sec += epoch.tv_sec; - rt->tv_usec += epoch.tv_usec; - while (rt->tv_usec >= 1000000) { - rt->tv_sec += 1; - rt->tv_usec -= 1000000; - } - return; -} - -static void -absolute_deflate(struct timeval *rt, struct timeval *vt) { - double d; - - vt->tv_sec = rt->tv_sec; - vt->tv_usec = rt->tv_usec; - - if ((epoch.tv_sec > rt->tv_sec) || - ((epoch.tv_sec == rt->tv_sec) && (epoch.tv_usec > rt->tv_usec))) - return; - - vt->tv_sec -= epoch.tv_sec; - vt->tv_usec -= epoch.tv_usec; - while (vt->tv_usec < 0) { - vt->tv_sec -= 1; - vt->tv_usec += 1000000; - } - - if (vt->tv_sec == 0) - goto done; - - d = (double) vt->tv_sec; - d += (double) vt->tv_usec / 1000000.; - d = log(d); - vt->tv_sec = (time_t) d; - d -= (double) vt->tv_sec; - vt->tv_sec += 1; - vt->tv_usec = (suseconds_t) (d * 1000000.); - - done: - vt->tv_sec += epoch.tv_sec; - vt->tv_usec += epoch.tv_usec; - while (vt->tv_usec >= 1000000) { - vt->tv_sec += 1; - vt->tv_usec -= 1000000; - } - return; -} - -static void -interval_inflate(struct timeval *vt, struct timeval *rt) { - struct timeval now, tv; - - (void) gettimeofday(&now, NULL); - - absolute_deflate(&now, &tv); - - tv.tv_sec += vt->tv_sec; - tv.tv_usec += vt->tv_usec; - while (tv.tv_usec >= 1000000) { - tv.tv_sec += 1; - tv.tv_usec -= 1000000; - } - - absolute_inflate(&tv, rt); - - rt->tv_sec -= now.tv_sec; - rt->tv_usec -= now.tv_usec; - if (rt->tv_usec < 0) { - rt->tv_sec -= 1; - rt->tv_usec += 1000000; - } - return; -} - -static void -interval_deflate(struct timeval *rt, struct timeval *vt) { - struct timeval now, tv; - - vt->tv_sec = rt->tv_sec; - vt->tv_usec = rt->tv_usec; - - if ((vt->tv_sec == 0) && (vt->tv_usec <= 10000)) - return; - - (void) gettimeofday(&now, NULL); - - tv.tv_sec = now.tv_sec + rt->tv_sec; - tv.tv_usec = now.tv_usec + rt->tv_usec; - while (tv.tv_usec >= 1000000) { - tv.tv_sec += 1; - tv.tv_usec -= 1000000; - } - - absolute_deflate(&now, &now); - absolute_deflate(&tv, vt); - - vt->tv_sec -= now.tv_sec; - vt->tv_usec -= now.tv_usec; - while (vt->tv_usec < 0) { - vt->tv_sec -= 1; - vt->tv_usec += 1000000; - } - - if ((vt->tv_sec == 0) && (vt->tv_usec < 10000)) - vt->tv_usec = 10000; - return; -} -#endif - -int -gettimeofday(struct timeval *tv, struct timezone *tz) { -#ifdef VIRTUAL_TIME - struct timeval now; - int ret; - - if (!_init_called) _init(); - - if (epoch.tv_sec == 0) - return syscall(SYS_gettimeofday, tv, tz); - - ret = syscall(SYS_gettimeofday, &now, tz); - if (ret == 0) - absolute_inflate(&now, tv); - return ret; -#else - return syscall(SYS_gettimeofday, tv, tz); -#endif -} - -#ifdef SYS_select -int -select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, - struct timeval *timeout) -{ -#ifdef VIRTUAL_TIME - struct timeval tv; - - if (!_init_called) _init(); - - if (epoch.tv_sec == 0 || timeout == NULL || - (timeout->tv_sec == 0 && timeout->tv_usec == 0)) - return syscall(SYS_select, nfds, rfds, wfds, xfds, timeout); - - interval_deflate(timeout, &tv); - return syscall(SYS_select, nfds, rfds, wfds, xfds, &tv); -#else - return syscall(SYS_select, nfds, rfds, wfds, xfds, timeout); -#endif -} -#endif - -#ifdef SYS_poll -int -poll(struct pollfd fds[], nfds_t nfds, int timeout) { -#ifdef VIRTUAL_TIME - struct timeval in, out; - - if (!_init_called) _init(); - - if (timeout <= 0 || epoch.tv_sec == 0) - return syscall(SYS_poll, fds, nfds, timeout); - - in.tv_sec = timeout / 1000; - in.tv_usec = (timeout % 1000) * 1000; - interval_deflate(&in, &out); - timeout = out.tv_sec * 1000 + out.tv_usec / 1000; - return syscall(SYS_poll, fds, nfds, timeout); -#else - return syscall(SYS_poll, fds, nfds, timeout); -#endif -} -#endif - -#ifdef SYS_kevent -int -kevent(int kq, struct kevent *changelist, int nchanges, - struct kevent *eventlist, int nevents, const struct timespec *timeout) -{ -#ifdef VIRTUAL_TIME - struct timeval in, out; - struct timespec ts; - - if (!_init_called) _init(); - - if (epoch.tv_sec == 0 || timeout == NULL || - (timeout->tv_sec == 0 && timeout->tv_nsec == 0)) - return syscall(SYS_kevent, kq, changelist, nchanges, - eventlist, nevents, timeout); - - in.tv_sec = timeout->tv_sec; - in.tv_usec = timeout->tv_nsec / 1000; - interval_deflate(&in, &out); - ts.tv_sec = out.tv_sec; - ts.tv_nsec = out.tv_usec * 1000; - return syscall(SYS_kevent, kq, changelist, nchanges, eventlist, - nevents, &ts); -#else - return syscall(SYS_kevent, kq, changelist, nchanges, eventlist, - nevents, timeout); -#endif -} -#endif - -#ifdef SYS_epoll_wait -int -epoll_wait(int fd, struct epoll_event *events, int maxevents, int timeout) { -#ifdef VIRTUAL_TIME - struct timeval in, out; - - if (!_init_called) _init(); - - if (timeout == 0 || timeout == -1 || epoch.tv_sec == 0) - return syscall(SYS_epoll_wait, fd, events, maxevents, timeout); - - in.tv_sec = timeout / 1000; - in.tv_usec = (timeout % 1000) * 1000; - interval_deflate(&in, &out); - timeout = out.tv_sec * 1000 + out.tv_usec / 1000; - return syscall(SYS_poll, fd, events, maxevents, timeout); -#else - return syscall(SYS_poll, fd, events, maxevents, timeout); -#endif -} -#endif -#endif