mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
Merge branch '745-start.pl-refactoring' into 'master'
start.pl - wait for server to say 'running', refactor Closes #745 See merge request isc-projects/bind9!1141
This commit is contained in:
@@ -695,8 +695,8 @@ echo_i "check that named restarts with multiple added zones ($n)"
|
|||||||
ret=0
|
ret=0
|
||||||
$RNDCCMD 10.53.0.3 addzone "test4.baz" '{ type master; file "e.db"; };' > /dev/null 2>&1 || ret=1
|
$RNDCCMD 10.53.0.3 addzone "test4.baz" '{ type master; file "e.db"; };' > /dev/null 2>&1 || ret=1
|
||||||
$RNDCCMD 10.53.0.3 addzone "test5.baz" '{ type master; file "e.db"; };' > /dev/null 2>&1 || ret=1
|
$RNDCCMD 10.53.0.3 addzone "test5.baz" '{ type master; file "e.db"; };' > /dev/null 2>&1 || ret=1
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl addzone ns3
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3 || ret=1
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} addzone ns3 || ret=1
|
||||||
$DIG $DIGOPTS @10.53.0.3 version.bind txt ch > dig.out.test$n || ret=1
|
$DIG $DIGOPTS @10.53.0.3 version.bind txt ch > dig.out.test$n || ret=1
|
||||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
|
@@ -1989,7 +1989,7 @@ echo_i "waiting till 14s have passed since NTAs were added before restarting ns4
|
|||||||
$PERL -e 'my $delay = '$start' + 14 - time(); select(undef, undef, undef, $delay) if ($delay > 0);'
|
$PERL -e 'my $delay = '$start' + 14 - time(); select(undef, undef, undef, $delay) if ($delay > 0);'
|
||||||
|
|
||||||
if
|
if
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns4
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} dnssec ns4
|
||||||
then
|
then
|
||||||
echo_i "restarted server ns4"
|
echo_i "restarted server ns4"
|
||||||
else
|
else
|
||||||
@@ -2057,7 +2057,7 @@ echo "secure.example. regular $future" > ns4/_default.nta
|
|||||||
start=`$PERL -e 'print time()."\n";'`
|
start=`$PERL -e 'print time()."\n";'`
|
||||||
|
|
||||||
if
|
if
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns4
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} dnssec ns4
|
||||||
then
|
then
|
||||||
echo_i "restarted server ns4"
|
echo_i "restarted server ns4"
|
||||||
else
|
else
|
||||||
@@ -2114,7 +2114,7 @@ echo "secure.example. forced $future" > ns4/_default.nta
|
|||||||
start=`$PERL -e 'print time()."\n";'`
|
start=`$PERL -e 'print time()."\n";'`
|
||||||
|
|
||||||
if
|
if
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns4
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} dnssec ns4
|
||||||
then
|
then
|
||||||
echo_i "restarted server ns4"
|
echo_i "restarted server ns4"
|
||||||
else
|
else
|
||||||
@@ -2163,7 +2163,7 @@ echo "secure.example. forced $future" > ns4/_default.nta
|
|||||||
added=`$PERL -e 'print time()."\n";'`
|
added=`$PERL -e 'print time()."\n";'`
|
||||||
|
|
||||||
if
|
if
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns4
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} dnssec ns4
|
||||||
then
|
then
|
||||||
echo_i "restarted server ns4"
|
echo_i "restarted server ns4"
|
||||||
else
|
else
|
||||||
|
@@ -88,10 +88,10 @@ echo_i "checking for negative caching of forwarder response"
|
|||||||
ret=0
|
ret=0
|
||||||
$DIG $DIGOPTS nonexist. txt @10.53.0.5 > dig.out.f2 || ret=1
|
$DIG $DIGOPTS nonexist. txt @10.53.0.5 > dig.out.f2 || ret=1
|
||||||
grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
|
grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
|
||||||
$PERL ../stop.pl . ns4 || ret=1
|
$PERL ../stop.pl forward ns4 || ret=1
|
||||||
$DIG $DIGOPTS nonexist. txt @10.53.0.5 > dig.out.f2 || ret=1
|
$DIG $DIGOPTS nonexist. txt @10.53.0.5 > dig.out.f2 || ret=1
|
||||||
grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
|
grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
|
||||||
$PERL ../start.pl --restart --noclean --port ${PORT} . ns4 || ret=1
|
$PERL ../start.pl --restart --noclean --port ${PORT} forward ns4 || ret=1
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
|
@@ -455,14 +455,14 @@ status=`expr $status + $ret`
|
|||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "stop bump in the wire signer server ($n)"
|
echo_i "stop bump in the wire signer server ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$PERL ../stop.pl . ns3 || ret=1
|
$PERL ../stop.pl inline ns3 || ret=1
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "restart bump in the wire signer server ($n)"
|
echo_i "restart bump in the wire signer server ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$PERL ../start.pl --noclean --restart --port ${PORT} . ns3 || ret=1
|
$PERL ../start.pl --noclean --restart --port ${PORT} inline ns3 || ret=1
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
@@ -869,7 +869,7 @@ status=`expr $status + $ret`
|
|||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "stop bump in the wire signer server ($n)"
|
echo_i "stop bump in the wire signer server ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$PERL ../stop.pl . ns3 || ret=1
|
$PERL ../stop.pl inline ns3 || ret=1
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
@@ -880,7 +880,7 @@ rm ns3/master.db.jnl
|
|||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "restart bump in the wire signer server ($n)"
|
echo_i "restart bump in the wire signer server ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$PERL ../start.pl --noclean --restart --port ${PORT} . ns3 || ret=1
|
$PERL ../start.pl --noclean --restart --port ${PORT} inline ns3 || ret=1
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
@@ -1323,18 +1323,18 @@ done
|
|||||||
if [ $ans != 0 ]; then ret=1; fi
|
if [ $ans != 0 ]; then ret=1; fi
|
||||||
# Halt rather than stopping the server to prevent the master file from being
|
# Halt rather than stopping the server to prevent the master file from being
|
||||||
# flushed upon shutdown since we specifically want to avoid it.
|
# flushed upon shutdown since we specifically want to avoid it.
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --halt --port ${CONTROLPORT} . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --halt --port ${CONTROLPORT} inline ns3
|
||||||
ensure_sigs_only_in_journal delayedkeys ns3/delayedkeys.db.signed
|
ensure_sigs_only_in_journal delayedkeys ns3/delayedkeys.db.signed
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} inline ns3
|
||||||
# At this point, the raw zone journal will not have a source serial set. Upon
|
# At this point, the raw zone journal will not have a source serial set. Upon
|
||||||
# server startup, receive_secure_serial() will rectify that, update SOA, resign
|
# server startup, receive_secure_serial() will rectify that, update SOA, resign
|
||||||
# it, and schedule its future resign. This will cause "rndc zonestatus" to
|
# it, and schedule its future resign. This will cause "rndc zonestatus" to
|
||||||
# return delayedkeys/SOA as the next node to resign, so we restart the server
|
# return delayedkeys/SOA as the next node to resign, so we restart the server
|
||||||
# once again; with the raw zone journal now having a source serial set,
|
# once again; with the raw zone journal now having a source serial set,
|
||||||
# receive_secure_serial() should refrain from introducing any zone changes.
|
# receive_secure_serial() should refrain from introducing any zone changes.
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --halt --port ${CONTROLPORT} . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --halt --port ${CONTROLPORT} inline ns3
|
||||||
ensure_sigs_only_in_journal delayedkeys ns3/delayedkeys.db.signed
|
ensure_sigs_only_in_journal delayedkeys ns3/delayedkeys.db.signed
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} inline ns3
|
||||||
# We can now test whether the secure zone journal was correctly processed:
|
# We can now test whether the secure zone journal was correctly processed:
|
||||||
# unless the records contained in it were scheduled for resigning, no resigning
|
# unless the records contained in it were scheduled for resigning, no resigning
|
||||||
# event will be scheduled at all since the secure zone master file contains no
|
# event will be scheduled at all since the secure zone master file contains no
|
||||||
|
@@ -196,11 +196,11 @@ grep "status: NOERROR" dig.out.test$n > /dev/null && ret=1
|
|||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns1
|
$PERL $SYSTEMTESTTOP/stop.pl legacy ns1
|
||||||
|
|
||||||
copy_setports ns1/named2.conf.in ns1/named.conf
|
copy_setports ns1/named2.conf.in ns1/named.conf
|
||||||
|
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns1
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} legacy ns1
|
||||||
|
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "checking recursive lookup to edns 512 + no tcp + trust anchor fails ($n)"
|
echo_i "checking recursive lookup to edns 512 + no tcp + trust anchor fails ($n)"
|
||||||
|
@@ -159,7 +159,7 @@ fi
|
|||||||
# files while controlling the stop/start of the server.
|
# files while controlling the stop/start of the server.
|
||||||
# Have to stop the stock server because it uses "-g"
|
# Have to stop the stock server because it uses "-g"
|
||||||
#
|
#
|
||||||
$PERL ../../stop.pl .. ns1
|
$PERL ../../stop.pl logfileconfig ns1
|
||||||
|
|
||||||
$myNAMED > /dev/null 2>&1
|
$myNAMED > /dev/null 2>&1
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ n=`expr $n + 1`
|
|||||||
echo_i "testing default logfile using named -L file ($n)"
|
echo_i "testing default logfile using named -L file ($n)"
|
||||||
# Now stop the server again and test the -L option
|
# Now stop the server again and test the -L option
|
||||||
rm -f $DLFILE
|
rm -f $DLFILE
|
||||||
$PERL ../../stop.pl .. ns1
|
$PERL ../../stop.pl logfileconfig ns1
|
||||||
if ! test -f $PIDFILE; then
|
if ! test -f $PIDFILE; then
|
||||||
copy_setports $PLAINCONF named.conf
|
copy_setports $PLAINCONF named.conf
|
||||||
$myNAMED -L $DLFILE > /dev/null 2>&1
|
$myNAMED -L $DLFILE > /dev/null 2>&1
|
||||||
|
@@ -72,7 +72,7 @@ stomp () {
|
|||||||
|
|
||||||
restart () {
|
restart () {
|
||||||
sleep 1
|
sleep 1
|
||||||
(cd ..; $PERL start.pl --noclean --restart --port ${PORT} masterformat ns3)
|
$PERL "$SYSTEMTESTTOP/start.pl" --noclean --restart --port ${PORT} masterformat ns3
|
||||||
}
|
}
|
||||||
|
|
||||||
DIGOPTS="+tcp +noauth +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}"
|
DIGOPTS="+tcp +noauth +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}"
|
||||||
|
@@ -165,10 +165,10 @@ status=`expr $status + $ret`
|
|||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "checking that loading a correctly signed mirror zone from disk succeeds ($n)"
|
echo_i "checking that loading a correctly signed mirror zone from disk succeeds ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mirror ns3
|
||||||
cat ns2/verify-load.db.good.signed > ns3/verify-load.db.mirror
|
cat ns2/verify-load.db.good.signed > ns3/verify-load.db.mirror
|
||||||
nextpart ns3/named.run > /dev/null
|
nextpart ns3/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mirror ns3
|
||||||
wait_for_load verify-load ${UPDATED_SERIAL_GOOD} ns3/named.run
|
wait_for_load verify-load ${UPDATED_SERIAL_GOOD} ns3/named.run
|
||||||
$DIG $DIGOPTS @10.53.0.3 +norec verify-load SOA > dig.out.ns3.test$n 2>&1 || ret=1
|
$DIG $DIGOPTS @10.53.0.3 +norec verify-load SOA > dig.out.ns3.test$n 2>&1 || ret=1
|
||||||
grep "${UPDATED_SERIAL_GOOD}.*; serial" dig.out.ns3.test$n > /dev/null || ret=1
|
grep "${UPDATED_SERIAL_GOOD}.*; serial" dig.out.ns3.test$n > /dev/null || ret=1
|
||||||
@@ -178,11 +178,11 @@ status=`expr $status + $ret`
|
|||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "checking that loading a journal for an incorrectly signed mirror zone fails ($n)"
|
echo_i "checking that loading a journal for an incorrectly signed mirror zone fails ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mirror ns3
|
||||||
cp ns3/verify-journal.db.mirror ns3/verify-ixfr.db.mirror
|
cp ns3/verify-journal.db.mirror ns3/verify-ixfr.db.mirror
|
||||||
cp ns3/verify-journal.db.bad.mirror.jnl ns3/verify-ixfr.db.mirror.jnl
|
cp ns3/verify-journal.db.bad.mirror.jnl ns3/verify-ixfr.db.mirror.jnl
|
||||||
nextpart ns3/named.run > /dev/null
|
nextpart ns3/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mirror ns3
|
||||||
wait_for_load verify-ixfr ${UPDATED_SERIAL_BAD} ns3/named.run
|
wait_for_load verify-ixfr ${UPDATED_SERIAL_BAD} ns3/named.run
|
||||||
$DIG $DIGOPTS @10.53.0.3 +norec verify-ixfr SOA > dig.out.ns3.test$n 2>&1 || ret=1
|
$DIG $DIGOPTS @10.53.0.3 +norec verify-ixfr SOA > dig.out.ns3.test$n 2>&1 || ret=1
|
||||||
grep "${UPDATED_SERIAL_BAD}.*; serial" dig.out.ns3.test$n > /dev/null && ret=1
|
grep "${UPDATED_SERIAL_BAD}.*; serial" dig.out.ns3.test$n > /dev/null && ret=1
|
||||||
@@ -193,11 +193,11 @@ status=`expr $status + $ret`
|
|||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "checking that loading a journal for a correctly signed mirror zone succeeds ($n)"
|
echo_i "checking that loading a journal for a correctly signed mirror zone succeeds ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mirror ns3
|
||||||
cp ns3/verify-journal.db.mirror ns3/verify-ixfr.db.mirror
|
cp ns3/verify-journal.db.mirror ns3/verify-ixfr.db.mirror
|
||||||
cp ns3/verify-journal.db.good.mirror.jnl ns3/verify-ixfr.db.mirror.jnl
|
cp ns3/verify-journal.db.good.mirror.jnl ns3/verify-ixfr.db.mirror.jnl
|
||||||
nextpart ns3/named.run > /dev/null
|
nextpart ns3/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mirror ns3
|
||||||
wait_for_load verify-ixfr ${UPDATED_SERIAL_GOOD} ns3/named.run
|
wait_for_load verify-ixfr ${UPDATED_SERIAL_GOOD} ns3/named.run
|
||||||
$DIG $DIGOPTS @10.53.0.3 +norec verify-ixfr SOA > dig.out.ns3.test$n 2>&1 || ret=1
|
$DIG $DIGOPTS @10.53.0.3 +norec verify-ixfr SOA > dig.out.ns3.test$n 2>&1 || ret=1
|
||||||
grep "${UPDATED_SERIAL_GOOD}.*; serial" dig.out.ns3.test$n > /dev/null || ret=1
|
grep "${UPDATED_SERIAL_GOOD}.*; serial" dig.out.ns3.test$n > /dev/null || ret=1
|
||||||
@@ -329,10 +329,10 @@ mv ns2/named.conf.modified ns2/named.conf
|
|||||||
$RNDCCMD 10.53.0.2 reconfig > /dev/null 2>&1
|
$RNDCCMD 10.53.0.2 reconfig > /dev/null 2>&1
|
||||||
# Stop ns3, update the timestamp of the zone file to one far in the past, then
|
# Stop ns3, update the timestamp of the zone file to one far in the past, then
|
||||||
# restart ns3.
|
# restart ns3.
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mirror ns3
|
||||||
touch -t 200001010000 ns3/initially-unavailable.db.mirror
|
touch -t 200001010000 ns3/initially-unavailable.db.mirror
|
||||||
nextpart ns3/named.run > /dev/null
|
nextpart ns3/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mirror ns3
|
||||||
# Ensure named attempts to retransfer the zone due to its expiry.
|
# Ensure named attempts to retransfer the zone due to its expiry.
|
||||||
wait_for_transfer initially-unavailable
|
wait_for_transfer initially-unavailable
|
||||||
nextpart ns3/named.run | grep "initially-unavailable.*expired" > /dev/null || ret=1
|
nextpart ns3/named.run | grep "initially-unavailable.*expired" > /dev/null || ret=1
|
||||||
|
@@ -299,11 +299,11 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
|
|||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
echo_i "reinitialize trust anchors, add second key to bind.keys"
|
echo_i "reinitialize trust anchors, add second key to bind.keys"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns2
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mkeys ns2
|
||||||
rm -f ns2/managed-keys.bind*
|
rm -f ns2/managed-keys.bind*
|
||||||
keyfile_to_managed_keys ns1/$original ns1/$standby1 > ns2/managed.conf
|
keyfile_to_managed_keys ns1/$original ns1/$standby1 > ns2/managed.conf
|
||||||
nextpart ns2/named.run > /dev/null
|
nextpart ns2/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns2
|
||||||
|
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "check that no key from bind.keys is marked as an initializing key ($n)"
|
echo_i "check that no key from bind.keys is marked as an initializing key ($n)"
|
||||||
@@ -315,11 +315,11 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
|
|||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
echo_i "reinitialize trust anchors, revert to one key in bind.keys"
|
echo_i "reinitialize trust anchors, revert to one key in bind.keys"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns2
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mkeys ns2
|
||||||
rm -f ns2/managed-keys.bind*
|
rm -f ns2/managed-keys.bind*
|
||||||
mv ns2/managed1.conf ns2/managed.conf
|
mv ns2/managed1.conf ns2/managed.conf
|
||||||
nextpart ns2/named.run > /dev/null
|
nextpart ns2/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns2
|
||||||
|
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "check that standby key is now trusted ($n)"
|
echo_i "check that standby key is now trusted ($n)"
|
||||||
@@ -473,10 +473,10 @@ rm -f ns1/root.db.signed.jnl
|
|||||||
mkeys_reconfig_on 1
|
mkeys_reconfig_on 1
|
||||||
|
|
||||||
echo_i "reinitialize trust anchors"
|
echo_i "reinitialize trust anchors"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns2
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mkeys ns2
|
||||||
rm -f ns2/managed-keys.bind*
|
rm -f ns2/managed-keys.bind*
|
||||||
nextpart ns2/named.run > /dev/null
|
nextpart ns2/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns2
|
||||||
|
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "check positive validation ($n)"
|
echo_i "check positive validation ($n)"
|
||||||
@@ -572,11 +572,11 @@ ret=0
|
|||||||
mkeys_refresh_on 2
|
mkeys_refresh_on 2
|
||||||
mkeys_status_on 2 > rndc.out.$n 2>&1
|
mkeys_status_on 2 > rndc.out.$n 2>&1
|
||||||
t1=`grep 'next refresh:' rndc.out.$n`
|
t1=`grep 'next refresh:' rndc.out.$n`
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns1
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mkeys ns1
|
||||||
rm -f ns1/root.db.signed.jnl
|
rm -f ns1/root.db.signed.jnl
|
||||||
cp ns1/root.db ns1/root.db.signed
|
cp ns1/root.db ns1/root.db.signed
|
||||||
nextpart ns1/named.run > /dev/null
|
nextpart ns1/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns1
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns1
|
||||||
wait_for_log "loaded serial" ns1/named.run
|
wait_for_log "loaded serial" ns1/named.run
|
||||||
mkeys_refresh_on 2
|
mkeys_refresh_on 2
|
||||||
mkeys_status_on 2 > rndc.out.$n 2>&1
|
mkeys_status_on 2 > rndc.out.$n 2>&1
|
||||||
@@ -606,11 +606,11 @@ ret=0
|
|||||||
mkeys_refresh_on 2
|
mkeys_refresh_on 2
|
||||||
mkeys_status_on 2 > rndc.out.$n 2>&1
|
mkeys_status_on 2 > rndc.out.$n 2>&1
|
||||||
t1=`grep 'next refresh:' rndc.out.$n`
|
t1=`grep 'next refresh:' rndc.out.$n`
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns1
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mkeys ns1
|
||||||
rm -f ns1/root.db.signed.jnl
|
rm -f ns1/root.db.signed.jnl
|
||||||
cat ns1/K*.key >> ns1/root.db.signed
|
cat ns1/K*.key >> ns1/root.db.signed
|
||||||
nextpart ns1/named.run > /dev/null
|
nextpart ns1/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns1
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns1
|
||||||
wait_for_log "loaded serial" ns1/named.run
|
wait_for_log "loaded serial" ns1/named.run
|
||||||
# Less than a second may have passed since the last time ns2 received a
|
# Less than a second may have passed since the last time ns2 received a
|
||||||
# ./DNSKEY response from ns1. Ensure keys are refreshed at a different
|
# ./DNSKEY response from ns1. Ensure keys are refreshed at a different
|
||||||
@@ -708,9 +708,9 @@ ret=0
|
|||||||
# ensure key refresh retry will be scheduled to one actual hour after the first
|
# ensure key refresh retry will be scheduled to one actual hour after the first
|
||||||
# key refresh failure instead of just a few seconds, in order to prevent races
|
# key refresh failure instead of just a few seconds, in order to prevent races
|
||||||
# between the next scheduled key refresh time and startup time of restarted ns5.
|
# between the next scheduled key refresh time and startup time of restarted ns5.
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns5
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mkeys ns5
|
||||||
nextpart ns5/named.run > /dev/null
|
nextpart ns5/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns5
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns5
|
||||||
wait_for_log "Returned from key fetch in keyfetch_done()" ns5/named.run
|
wait_for_log "Returned from key fetch in keyfetch_done()" ns5/named.run
|
||||||
# ns5/named.run will contain logs from both the old instance and the new
|
# ns5/named.run will contain logs from both the old instance and the new
|
||||||
# instance. In order for the test to pass, both must attempt a fetch.
|
# instance. In order for the test to pass, both must attempt a fetch.
|
||||||
@@ -722,14 +722,14 @@ status=`expr $status + $ret`
|
|||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "check key refreshes are resumed after root servers become available ($n)"
|
echo_i "check key refreshes are resumed after root servers become available ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns5
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mkeys ns5
|
||||||
# Prevent previous check from affecting this one
|
# Prevent previous check from affecting this one
|
||||||
rm -f ns5/managed-keys.bind*
|
rm -f ns5/managed-keys.bind*
|
||||||
# named2.args adds "-T mkeytimers=2/20/40" to named1.args as we need to wait for
|
# named2.args adds "-T mkeytimers=2/20/40" to named1.args as we need to wait for
|
||||||
# an "hour" until keys are refreshed again after initial failure
|
# an "hour" until keys are refreshed again after initial failure
|
||||||
cp ns5/named2.args ns5/named.args
|
cp ns5/named2.args ns5/named.args
|
||||||
nextpart ns5/named.run > /dev/null
|
nextpart ns5/named.run > /dev/null
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns5
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns5
|
||||||
wait_for_log "Returned from key fetch in keyfetch_done() for '.': failure" ns5/named.run
|
wait_for_log "Returned from key fetch in keyfetch_done() for '.': failure" ns5/named.run
|
||||||
mkeys_secroots_on 5
|
mkeys_secroots_on 5
|
||||||
grep '; initializing managed' ns5/named.secroots > /dev/null 2>&1 || ret=1
|
grep '; initializing managed' ns5/named.secroots > /dev/null 2>&1 || ret=1
|
||||||
|
@@ -115,12 +115,12 @@ digcomp dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
|
|||||||
status=`expr $ret + $status`
|
status=`expr $ret + $status`
|
||||||
|
|
||||||
echo_i "stopping master and restarting with example4 then waiting up to 45 seconds"
|
echo_i "stopping master and restarting with example4 then waiting up to 45 seconds"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns2
|
$PERL $SYSTEMTESTTOP/stop.pl notify ns2
|
||||||
|
|
||||||
rm -f ns2/example.db
|
rm -f ns2/example.db
|
||||||
cp -f ns2/example4.db ns2/example.db
|
cp -f ns2/example4.db ns2/example.db
|
||||||
|
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} notify ns2
|
||||||
|
|
||||||
try=0
|
try=0
|
||||||
while test $try -lt 45
|
while test $try -lt 45
|
||||||
|
@@ -338,7 +338,7 @@ rm named.pid
|
|||||||
cd ..
|
cd ..
|
||||||
sleep 10
|
sleep 10
|
||||||
if
|
if
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns1
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} nsupdate ns1
|
||||||
then
|
then
|
||||||
echo_i "restarted server ns1"
|
echo_i "restarted server ns1"
|
||||||
else
|
else
|
||||||
@@ -506,12 +506,12 @@ server 10.53.0.1 ${PORT}
|
|||||||
update add updated4.example.nil. 600 A 10.10.10.3
|
update add updated4.example.nil. 600 A 10.10.10.3
|
||||||
send
|
send
|
||||||
END
|
END
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns1
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} nsupdate ns1
|
||||||
# Removing the journal file and restarting the server means
|
# Removing the journal file and restarting the server means
|
||||||
# that the data served by the new server process are exactly
|
# that the data served by the new server process are exactly
|
||||||
# those dumped to the master file by "rndc stop".
|
# those dumped to the master file by "rndc stop".
|
||||||
rm -f ns1/*jnl
|
rm -f ns1/*jnl
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns1
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} nsupdate ns1
|
||||||
$DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd updated4.example.nil.\
|
$DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd updated4.example.nil.\
|
||||||
@10.53.0.1 a > dig.out.ns1 || status=1
|
@10.53.0.1 a > dig.out.ns1 || status=1
|
||||||
digcomp knowngood.ns1.afterstop dig.out.ns1 || ret=1
|
digcomp knowngood.ns1.afterstop dig.out.ns1 || ret=1
|
||||||
|
@@ -39,7 +39,7 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
|
|||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
echo_i "stopping ns1"
|
echo_i "stopping ns1"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns1
|
$PERL $SYSTEMTESTTOP/stop.pl nzd2nzf ns1
|
||||||
|
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "dumping _default.nzd to _default.nzf ($n)"
|
echo_i "dumping _default.nzd to _default.nzf ($n)"
|
||||||
@@ -57,7 +57,7 @@ echo_i "deleting _default.nzd database"
|
|||||||
rm -f ns1/_default.nzd
|
rm -f ns1/_default.nzd
|
||||||
|
|
||||||
echo_i "starting ns1 which should migrate the .nzf to .nzd"
|
echo_i "starting ns1 which should migrate the .nzf to .nzd"
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns1
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} nzd2nzf ns1
|
||||||
|
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "querying for zone data from migrated zone config ($n)"
|
echo_i "querying for zone data from migrated zone config ($n)"
|
||||||
|
@@ -206,7 +206,7 @@ restart () {
|
|||||||
cp -f ns$1/base.db $NM
|
cp -f ns$1/base.db $NM
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns$1
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} rpz ns$1
|
||||||
load_db
|
load_db
|
||||||
dnsrps_loaded
|
dnsrps_loaded
|
||||||
}
|
}
|
||||||
@@ -430,7 +430,7 @@ for mode in native dnsrps; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo_i "attempting to configure servers with DNSRPS..."
|
echo_i "attempting to configure servers with DNSRPS..."
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl .
|
$PERL $SYSTEMTESTTOP/stop.pl rpz
|
||||||
$SHELL ./setup.sh -N -D $DEBUG
|
$SHELL ./setup.sh -N -D $DEBUG
|
||||||
for server in ns*; do
|
for server in ns*; do
|
||||||
resetstats $server
|
resetstats $server
|
||||||
@@ -445,7 +445,7 @@ for mode in native dnsrps; do
|
|||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
echo_i "running DNSRPS sub-test"
|
echo_i "running DNSRPS sub-test"
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} .
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} rpz
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -741,7 +741,7 @@ EOF
|
|||||||
|
|
||||||
# restart the main test RPZ server to see if that creates a core file
|
# restart the main test RPZ server to see if that creates a core file
|
||||||
if test -z "$HAVE_CORE"; then
|
if test -z "$HAVE_CORE"; then
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl rpz ns3
|
||||||
restart 3
|
restart 3
|
||||||
HAVE_CORE=`find ns* -name '*core*' -print`
|
HAVE_CORE=`find ns* -name '*core*' -print`
|
||||||
test -z "$HAVE_CORE" || setret "found $HAVE_CORE; memory leak?"
|
test -z "$HAVE_CORE" || setret "found $HAVE_CORE; memory leak?"
|
||||||
|
@@ -46,13 +46,13 @@ run_server() {
|
|||||||
TESTNAME=$1
|
TESTNAME=$1
|
||||||
|
|
||||||
echo_i "stopping resolver"
|
echo_i "stopping resolver"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns2
|
$PERL $SYSTEMTESTTOP/stop.pl rpzrecurse ns2
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
echo_i "starting resolver using named.$TESTNAME.conf"
|
echo_i "starting resolver using named.$TESTNAME.conf"
|
||||||
cp -f ns2/named.$TESTNAME.conf ns2/named.conf
|
cp -f ns2/named.$TESTNAME.conf ns2/named.conf
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} rpzrecurse ns2
|
||||||
sleep 3
|
sleep 3
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ for mode in native dnsrps; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo_i "attempting to configure servers with DNSRPS..."
|
echo_i "attempting to configure servers with DNSRPS..."
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl .
|
$PERL $SYSTEMTESTTOP/stop.pl rpzrecurse
|
||||||
$SHELL ./setup.sh -N -D $DEBUG
|
$SHELL ./setup.sh -N -D $DEBUG
|
||||||
sed -n 's/^## //p' dnsrps.conf | cat_i
|
sed -n 's/^## //p' dnsrps.conf | cat_i
|
||||||
if grep '^#fail' dnsrps.conf >/dev/null; then
|
if grep '^#fail' dnsrps.conf >/dev/null; then
|
||||||
@@ -134,7 +134,7 @@ for mode in native dnsrps; do
|
|||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
echo_i "running DNSRPS sub-test"
|
echo_i "running DNSRPS sub-test"
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} .
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} rpzrecurse
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@@ -251,7 +251,7 @@ fi
|
|||||||
|
|
||||||
echo_i "Re-starting slave"
|
echo_i "Re-starting slave"
|
||||||
|
|
||||||
(cd ..; $PERL start.pl --noclean --port ${PORT} rrsetorder ns2 )
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --port ${PORT} rrsetorder ns2
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@@ -51,7 +51,7 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
|
|||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
echo_i "disabling server to force non-dnssec SERVFAIL"
|
echo_i "disabling server to force non-dnssec SERVFAIL"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns2
|
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} sfcache ns2
|
||||||
awk '/SERVFAIL/ { next; out=1 } /Zone/ { out=0 } { if (out) print }' ns5/named_dump.db
|
awk '/SERVFAIL/ { next; out=1 } /Zone/ { out=0 } { if (out) print }' ns5/named_dump.db
|
||||||
echo_i "checking SERVFAIL is cached ($n)"
|
echo_i "checking SERVFAIL is cached ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
|
@@ -15,9 +15,12 @@
|
|||||||
# If a server is specified, start it. Otherwise, start all servers for test.
|
# If a server is specified, start it. Otherwise, start all servers for test.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Cwd;
|
use warnings;
|
||||||
use Cwd 'abs_path';
|
|
||||||
|
use Cwd ':DEFAULT', 'abs_path';
|
||||||
|
use English '-no_match_vars';
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
use Time::HiRes 'sleep'; # allows sleeping fractional seconds
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# perl start.pl [--noclean] [--restart] [--port port] test [server [options]]
|
# perl start.pl [--noclean] [--restart] [--port port] test [server [options]]
|
||||||
@@ -55,29 +58,34 @@ use Getopt::Long;
|
|||||||
# "named.args" is ignored.
|
# "named.args" is ignored.
|
||||||
|
|
||||||
my $usage = "usage: $0 [--noclean] [--restart] [--port <port>] test-directory [server-directory [server-options]]";
|
my $usage = "usage: $0 [--noclean] [--restart] [--port <port>] test-directory [server-directory [server-options]]";
|
||||||
my $noclean = '';
|
my $clean = 1;
|
||||||
my $restart = '';
|
my $restart = 0;
|
||||||
my $queryport = 5300;
|
my $queryport = 5300;
|
||||||
|
|
||||||
GetOptions('noclean' => \$noclean, 'restart' => \$restart, 'port=i' => \$queryport) or die "$usage\n";
|
GetOptions(
|
||||||
|
'clean!' => \$clean,
|
||||||
|
'restart!' => \$restart,
|
||||||
|
'port=i' => \$queryport,
|
||||||
|
) or die "$usage\n";
|
||||||
|
|
||||||
my $test = $ARGV[0];
|
my( $test, $server_arg, $options_arg ) = @ARGV;
|
||||||
my $server = $ARGV[1];
|
|
||||||
my $options = $ARGV[2];
|
|
||||||
|
|
||||||
if (!$test) {
|
if (!$test) {
|
||||||
die "$usage\n";
|
die "$usage\n";
|
||||||
}
|
}
|
||||||
if (!-d $test) {
|
|
||||||
die "No test directory: \"$test\"\n";
|
|
||||||
}
|
|
||||||
if ($server && !-d "$test/$server") {
|
|
||||||
die "No server directory: \"$test/$server\"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Global variables
|
# Global variables
|
||||||
my $topdir = abs_path("$test/..");
|
my $topdir = abs_path($ENV{'SYSTEMTESTTOP'});
|
||||||
my $testdir = abs_path("$test");
|
my $testdir = abs_path($topdir . "/" . $test);
|
||||||
|
|
||||||
|
if (! -d $testdir) {
|
||||||
|
die "No test directory: \"$testdir\"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($server_arg && ! -d "$testdir/$server_arg") {
|
||||||
|
die "No server directory: \"$testdir/$server_arg\"\n";
|
||||||
|
}
|
||||||
|
|
||||||
my $NAMED = $ENV{'NAMED'};
|
my $NAMED = $ENV{'NAMED'};
|
||||||
my $DIG = $ENV{'DIG'};
|
my $DIG = $ENV{'DIG'};
|
||||||
my $PERL = $ENV{'PERL'};
|
my $PERL = $ENV{'PERL'};
|
||||||
@@ -85,185 +93,107 @@ my $PYTHON = $ENV{'PYTHON'};
|
|||||||
|
|
||||||
# Start the server(s)
|
# Start the server(s)
|
||||||
|
|
||||||
if ($server) {
|
my @ns;
|
||||||
if ($server =~ /^ns/) {
|
my @ans;
|
||||||
&check_ports($server);
|
|
||||||
}
|
if ($server_arg) {
|
||||||
&start_server($server, $options);
|
if ($server_arg =~ /^ns/) {
|
||||||
if ($server =~ /^ns/) {
|
push(@ns, $server_arg);
|
||||||
&verify_server($server);
|
} elsif ($server_arg =~ /^ans/) {
|
||||||
|
push(@ans, $server_arg);
|
||||||
|
} else {
|
||||||
|
print "$0: ns or ans directory expected";
|
||||||
|
print "I:$test:failed";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
# Determine which servers need to be started for this test.
|
# Determine which servers need to be started for this test.
|
||||||
opendir DIR, $testdir;
|
opendir DIR, $testdir or die "unable to read test directory: \"$test\" ($OS_ERROR)\n";
|
||||||
my @files = sort readdir DIR;
|
my @files = sort readdir DIR;
|
||||||
closedir DIR;
|
closedir DIR;
|
||||||
|
|
||||||
my @ns = grep /^ns[0-9]*$/, @files;
|
@ns = grep /^ns[0-9]*$/, @files;
|
||||||
my @ans = grep /^ans[0-9]*$/, @files;
|
@ans = grep /^ans[0-9]*$/, @files;
|
||||||
my $name;
|
}
|
||||||
|
|
||||||
# Start the servers we found.
|
# Start the servers we found.
|
||||||
&check_ports();
|
|
||||||
foreach $name(@ns, @ans) {
|
foreach my $name(@ns) {
|
||||||
&start_server($name);
|
&check_ns_port($name);
|
||||||
&verify_server($name) if ($name =~ /^ns/);
|
&start_ns_server($name, $options_arg);
|
||||||
}
|
&verify_ns_server($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $name(@ans) {
|
||||||
|
&start_ans_server($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Subroutines
|
# Subroutines
|
||||||
|
|
||||||
sub check_ports {
|
sub read_ns_port {
|
||||||
my $server = shift;
|
my ( $server ) = @_;
|
||||||
my $options = "";
|
|
||||||
my $port = $queryport;
|
my $port = $queryport;
|
||||||
my $file = "";
|
my $options = "";
|
||||||
|
|
||||||
$file = $testdir . "/" . $server . "/named.port" if ($server);
|
if ($server) {
|
||||||
|
my $file = $testdir . "/" . $server . "/named.port";
|
||||||
|
|
||||||
if ($server && $server =~ /(\d+)$/) {
|
if (-e $file) {
|
||||||
|
open(my $fh, "<", $file) or die "unable to read ports file \"$file\" ($OS_ERROR)";
|
||||||
|
|
||||||
|
my $line = <$fh>;
|
||||||
|
|
||||||
|
if ($line) {
|
||||||
|
chomp $line;
|
||||||
|
$port = $line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ($port);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_ns_port {
|
||||||
|
my ( $server ) = @_;
|
||||||
|
my $options = "";
|
||||||
|
my $port = read_ns_port($server);
|
||||||
|
|
||||||
|
if ($server =~ /(\d+)$/) {
|
||||||
$options = "-i $1";
|
$options = "-i $1";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($file ne "" && -e $file) {
|
|
||||||
open(FH, "<", $file);
|
|
||||||
while(my $line=<FH>) {
|
|
||||||
chomp $line;
|
|
||||||
$port = $line;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
close FH;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $tries = 0;
|
my $tries = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
my $return = system("$PERL $topdir/testsock.pl -p $port $options");
|
my $return = system("$PERL $topdir/testsock.pl -p $port $options");
|
||||||
last if ($return == 0);
|
|
||||||
if (++$tries > 4) {
|
if ($return == 0) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tries++;
|
||||||
|
|
||||||
|
if ($tries > 4) {
|
||||||
print "$0: could not bind to server addresses, still running?\n";
|
print "$0: could not bind to server addresses, still running?\n";
|
||||||
print "I:server sockets not available\n";
|
print "I:$test:server sockets not available\n";
|
||||||
print "I:failed\n";
|
print "I:$test:failed\n";
|
||||||
system("$PERL $topdir/stop.pl $testdir"); # Is this the correct behavior?
|
|
||||||
|
system("$PERL $topdir/stop.pl $test"); # Is this the correct behavior?
|
||||||
|
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
print "I:Couldn't bind to socket (yet)\n";
|
|
||||||
|
print "I:$test:Couldn't bind to socket (yet)\n";
|
||||||
sleep 2;
|
sleep 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub start_server {
|
sub start_server {
|
||||||
my $server = shift;
|
my ( $server, $command, $pid_file ) = @_;
|
||||||
my $options = shift;
|
|
||||||
|
|
||||||
my $cleanup_files;
|
chdir "$testdir/$server" or die "unable to chdir \"$testdir/$server\" ($OS_ERROR)\n";
|
||||||
my $command;
|
|
||||||
my $pid_file;
|
|
||||||
my $cwd = getcwd();
|
|
||||||
my $args_file = $cwd . "/" . $test . "/" . $server . "/" . "named.args";
|
|
||||||
|
|
||||||
if ($server =~ /^ns/) {
|
|
||||||
$cleanup_files = "{*.jnl,*.bk,*.st,named.run}";
|
|
||||||
if ($ENV{'USE_VALGRIND'}) {
|
|
||||||
$command = "valgrind -q --gen-suppressions=all --num-callers=48 --fullpath-after= --log-file=named-$server-valgrind-%p.log ";
|
|
||||||
if ($ENV{'USE_VALGRIND'} eq 'helgrind') {
|
|
||||||
$command .= "--tool=helgrind ";
|
|
||||||
} else {
|
|
||||||
$command .= "--tool=memcheck --track-origins=yes --leak-check=full ";
|
|
||||||
}
|
|
||||||
$command .= "$NAMED -m none -M external ";
|
|
||||||
} else {
|
|
||||||
$command = "$NAMED ";
|
|
||||||
}
|
|
||||||
if ($options) {
|
|
||||||
$command .= "$options";
|
|
||||||
} elsif (-e $args_file) {
|
|
||||||
open(FH, "<", $args_file);
|
|
||||||
while(my $line=<FH>)
|
|
||||||
{
|
|
||||||
#$line =~ s/\R//g;
|
|
||||||
chomp $line;
|
|
||||||
next if ($line =~ /^\s*$/); #discard blank lines
|
|
||||||
next if ($line =~ /^\s*#/); #discard comment lines
|
|
||||||
$line =~ s/#.*$//g;
|
|
||||||
$options = $line;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
close FH;
|
|
||||||
$command .= "$options";
|
|
||||||
} else {
|
|
||||||
$command .= "-D $test-$server ";
|
|
||||||
$command .= "-X named.lock ";
|
|
||||||
$command .= "-m record,size,mctx ";
|
|
||||||
$command .= "-T clienttest ";
|
|
||||||
$command .= "-T dropedns "
|
|
||||||
if (-e "$testdir/$server/named.dropedns");
|
|
||||||
$command .= "-T ednsformerr "
|
|
||||||
if (-e "$testdir/$server/named.ednsformerr");
|
|
||||||
$command .= "-T ednsnotimp "
|
|
||||||
if (-e "$testdir/$server/named.ednsnotimp");
|
|
||||||
$command .= "-T ednsrefused "
|
|
||||||
if (-e "$testdir/$server/named.ednsrefused");
|
|
||||||
$command .= "-T noaa "
|
|
||||||
if (-e "$testdir/$server/named.noaa");
|
|
||||||
$command .= "-T noedns "
|
|
||||||
if (-e "$testdir/$server/named.noedns");
|
|
||||||
$command .= "-T nosoa "
|
|
||||||
if (-e "$testdir/$server/named.nosoa");
|
|
||||||
$command .= "-T maxudp512 "
|
|
||||||
if (-e "$testdir/$server/named.maxudp512");
|
|
||||||
$command .= "-T maxudp1460 "
|
|
||||||
if (-e "$testdir/$server/named.maxudp1460");
|
|
||||||
$command .= "-c named.conf -d 99 -g -U 4";
|
|
||||||
}
|
|
||||||
$command .= " -T notcp"
|
|
||||||
if (-e "$testdir/$server/named.notcp");
|
|
||||||
if ($restart) {
|
|
||||||
$command .= " >>named.run 2>&1 &";
|
|
||||||
} else {
|
|
||||||
$command .= " >named.run 2>&1 &";
|
|
||||||
}
|
|
||||||
$pid_file = "named.pid";
|
|
||||||
} elsif ($server =~ /^ans/) {
|
|
||||||
$cleanup_files = "{ans.run}";
|
|
||||||
if (-e "$testdir/$server/ans.py") {
|
|
||||||
$command = "$PYTHON -u ans.py 10.53.0.$' $queryport";
|
|
||||||
} elsif (-e "$testdir/$server/ans.pl") {
|
|
||||||
$command = "$PERL ans.pl";
|
|
||||||
} else {
|
|
||||||
$command = "$PERL $topdir/ans.pl 10.53.0.$'";
|
|
||||||
}
|
|
||||||
if ($options) {
|
|
||||||
$command .= "$options";
|
|
||||||
} else {
|
|
||||||
$command .= "";
|
|
||||||
}
|
|
||||||
if ($restart) {
|
|
||||||
$command .= " >>ans.run 2>&1 &";
|
|
||||||
} else {
|
|
||||||
$command .= " >ans.run 2>&1 &";
|
|
||||||
}
|
|
||||||
$pid_file = "ans.pid";
|
|
||||||
} else {
|
|
||||||
print "I:Unknown server type $server\n";
|
|
||||||
print "I:failed\n";
|
|
||||||
system "$PERL $topdir/stop.pl $testdir";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# print "I:starting server %s\n",$server;
|
|
||||||
|
|
||||||
chdir "$testdir/$server";
|
|
||||||
|
|
||||||
unless ($noclean) {
|
|
||||||
unlink glob $cleanup_files;
|
|
||||||
}
|
|
||||||
|
|
||||||
# get the shell to report the pid of the server ($!)
|
|
||||||
$command .= "echo \$!";
|
|
||||||
|
|
||||||
# start the server
|
# start the server
|
||||||
my $child = `$command`;
|
my $child = `$command`;
|
||||||
$child =~ s/\s+$//g;
|
$child =~ s/\s+$//;
|
||||||
|
|
||||||
# wait up to 14 seconds for the server to start and to write the
|
# wait up to 14 seconds for the server to start and to write the
|
||||||
# pid file otherwise kill this server and any others that have
|
# pid file otherwise kill this server and any others that have
|
||||||
@@ -271,51 +201,229 @@ sub start_server {
|
|||||||
my $tries = 0;
|
my $tries = 0;
|
||||||
while (!-s $pid_file) {
|
while (!-s $pid_file) {
|
||||||
if (++$tries > 140) {
|
if (++$tries > 140) {
|
||||||
print "I:Couldn't start server $server (pid=$child)\n";
|
print "I:$test:Couldn't start server $command (pid=$child)\n";
|
||||||
print "I:failed\n";
|
print "I:$test:failed\n";
|
||||||
system "kill -9 $child" if ("$child" ne "");
|
system "kill -9 $child" if ("$child" ne "");
|
||||||
system "$PERL $topdir/stop.pl $testdir";
|
system "$PERL $topdir/stop.pl $test";
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
# sleep for 0.1 seconds
|
sleep 0.1;
|
||||||
select undef,undef,undef,0.1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# go back to the top level directory
|
# go back to the top level directory
|
||||||
chdir $cwd;
|
chdir $topdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub verify_server {
|
sub construct_ns_command {
|
||||||
my $server = shift;
|
my ( $server, $options ) = @_;
|
||||||
my $n = $server;
|
|
||||||
my $port = $queryport;
|
|
||||||
my $tcp = "+tcp";
|
|
||||||
|
|
||||||
$n =~ s/^ns//;
|
my $command;
|
||||||
|
|
||||||
|
if ($ENV{'USE_VALGRIND'}) {
|
||||||
|
$command = "valgrind -q --gen-suppressions=all --num-callers=48 --fullpath-after= --log-file=named-$server-valgrind-%p.log ";
|
||||||
|
|
||||||
|
if ($ENV{'USE_VALGRIND'} eq 'helgrind') {
|
||||||
|
$command .= "--tool=helgrind ";
|
||||||
|
} else {
|
||||||
|
$command .= "--tool=memcheck --track-origins=yes --leak-check=full ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$command .= "$NAMED -m none -M external ";
|
||||||
|
} else {
|
||||||
|
$command = "$NAMED ";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $args_file = $testdir . "/" . $server . "/" . "named.args";
|
||||||
|
|
||||||
|
if ($options) {
|
||||||
|
$command .= $options;
|
||||||
|
} elsif (-e $args_file) {
|
||||||
|
open(my $fh, "<", $args_file) or die "unable to read args_file \"$args_file\" ($OS_ERROR)\n";
|
||||||
|
|
||||||
|
while(my $line=<$fh>) {
|
||||||
|
next if ($line =~ /^\s*$/); #discard blank lines
|
||||||
|
next if ($line =~ /^\s*#/); #discard comment lines
|
||||||
|
|
||||||
if (-e "$testdir/$server/named.port") {
|
|
||||||
open(FH, "<", "$testdir/$server/named.port");
|
|
||||||
while(my $line=<FH>) {
|
|
||||||
chomp $line;
|
chomp $line;
|
||||||
$port = $line;
|
|
||||||
|
$line =~ s/#.*$//;
|
||||||
|
|
||||||
|
$command .= $line;
|
||||||
|
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
close FH;
|
} else {
|
||||||
|
$command .= "-D $test-$server ";
|
||||||
|
$command .= "-X named.lock ";
|
||||||
|
$command .= "-m record,size,mctx ";
|
||||||
|
$command .= "-T clienttest ";
|
||||||
|
|
||||||
|
foreach my $t_option(
|
||||||
|
"dropedns", "ednsformerr", "ednsnotimp", "ednsrefused",
|
||||||
|
"noaa", "noedns", "nosoa", "maxudp512", "maxudp1460",
|
||||||
|
) {
|
||||||
|
if (-e "$testdir/$server/named.$t_option") {
|
||||||
|
$command .= "-T $t_option "
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tcp = "" if (-e "$testdir/$server/named.notcp");
|
$command .= "-c named.conf -d 99 -g -U 4";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-e "$testdir/$server/named.notcp") {
|
||||||
|
$command .= " -T notcp"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($restart) {
|
||||||
|
$command .= " >>named.run 2>&1 &";
|
||||||
|
} else {
|
||||||
|
$command .= " >named.run 2>&1 &";
|
||||||
|
}
|
||||||
|
|
||||||
|
# get the shell to report the pid of the server ($!)
|
||||||
|
$command .= " echo \$!";
|
||||||
|
|
||||||
|
return $command;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub start_ns_server {
|
||||||
|
my ( $server, $options ) = @_;
|
||||||
|
|
||||||
|
my $cleanup_files;
|
||||||
|
my $command;
|
||||||
|
my $pid_file;
|
||||||
|
|
||||||
|
$cleanup_files = "{./*.jnl,./*.bk,./*.st,./named.run}";
|
||||||
|
|
||||||
|
$command = construct_ns_command($server, $options);
|
||||||
|
|
||||||
|
$pid_file = "named.pid";
|
||||||
|
|
||||||
|
if ($clean) {
|
||||||
|
unlink glob $cleanup_files;
|
||||||
|
}
|
||||||
|
|
||||||
|
start_server($server, $command, $pid_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub construct_ans_command {
|
||||||
|
my ( $server, $options ) = @_;
|
||||||
|
|
||||||
|
my $command;
|
||||||
|
my $n;
|
||||||
|
|
||||||
|
if ($server =~ /^ans(\d+)/) {
|
||||||
|
$n = $1;
|
||||||
|
} else {
|
||||||
|
die "unable to parse server number from name \"$server\"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-e "$testdir/$server/ans.py") {
|
||||||
|
$command = "$PYTHON -u ans.py 10.53.0.$n $queryport";
|
||||||
|
} elsif (-e "$testdir/$server/ans.pl") {
|
||||||
|
$command = "$PERL ans.pl";
|
||||||
|
} else {
|
||||||
|
$command = "$PERL $topdir/ans.pl 10.53.0.$n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($options) {
|
||||||
|
$command .= $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($restart) {
|
||||||
|
$command .= " >>ans.run 2>&1 &";
|
||||||
|
} else {
|
||||||
|
$command .= " >ans.run 2>&1 &";
|
||||||
|
}
|
||||||
|
|
||||||
|
# get the shell to report the pid of the server ($!)
|
||||||
|
$command .= " echo \$!";
|
||||||
|
|
||||||
|
return $command;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub start_ans_server {
|
||||||
|
my ( $server, $options ) = @_;
|
||||||
|
|
||||||
|
my $cleanup_files;
|
||||||
|
my $command;
|
||||||
|
my $pid_file;
|
||||||
|
|
||||||
|
$cleanup_files = "{./ans.run}";
|
||||||
|
$command = construct_ans_command($server, $options);
|
||||||
|
$pid_file = "ans.pid";
|
||||||
|
|
||||||
|
if ($clean) {
|
||||||
|
unlink glob $cleanup_files;
|
||||||
|
}
|
||||||
|
|
||||||
|
start_server($server, $command, $pid_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub verify_ns_server {
|
||||||
|
my ( $server ) = @_;
|
||||||
|
|
||||||
my $tries = 0;
|
my $tries = 0;
|
||||||
|
|
||||||
|
my $runfile = "$testdir/$server/named.run";
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
my $return = system("$DIG $tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noedns -p $port version.bind. chaos txt \@10.53.0.$n > dig.out");
|
# the shell *ought* to have created the file immediately, but this
|
||||||
last if ($return == 0);
|
# logic allows the creation to be delayed without issues
|
||||||
if (++$tries >= 30) {
|
if (open(my $fh, "<", $runfile)) {
|
||||||
print "I:no response from $server\n";
|
# the two non-whitespace blobs should be the date and time
|
||||||
print "I:failed\n";
|
# but we don't care about them really, only that they are there
|
||||||
system("$PERL $topdir/stop.pl $testdir");
|
if (grep /^\S+ \S+ running$/, <$fh>) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tries++;
|
||||||
|
|
||||||
|
if ($tries >= 30) {
|
||||||
|
print "I:$test:server $server seems to have not started\n";
|
||||||
|
print "I:$test:failed\n";
|
||||||
|
|
||||||
|
system("$PERL $topdir/stop.pl $test");
|
||||||
|
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sleep 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tries = 0;
|
||||||
|
|
||||||
|
my $port = read_ns_port($server);
|
||||||
|
my $tcp = "+tcp";
|
||||||
|
my $n;
|
||||||
|
|
||||||
|
if ($server =~ /^ns(\d+)/) {
|
||||||
|
$n = $1;
|
||||||
|
} else {
|
||||||
|
die "unable to parse server number from name \"$server\"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-e "$testdir/$server/named.notcp") {
|
||||||
|
$tcp = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
my $return = system("$DIG $tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noedns -p $port version.bind. chaos txt \@10.53.0.$n > /dev/null");
|
||||||
|
|
||||||
|
last if ($return == 0);
|
||||||
|
|
||||||
|
$tries++;
|
||||||
|
|
||||||
|
if ($tries >= 30) {
|
||||||
|
print "I:$test:no response from $server\n";
|
||||||
|
print "I:$test:failed\n";
|
||||||
|
|
||||||
|
system("$PERL $topdir/stop.pl $test");
|
||||||
|
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
sleep 2;
|
sleep 2;
|
||||||
}
|
}
|
||||||
unlink "dig.out";
|
|
||||||
}
|
}
|
||||||
|
8
bin/tests/system/start.sh
Normal file → Executable file
8
bin/tests/system/start.sh
Normal file → Executable file
@@ -9,5 +9,9 @@
|
|||||||
# See the COPYRIGHT file distributed with this work for additional
|
# See the COPYRIGHT file distributed with this work for additional
|
||||||
# information regarding copyright ownership.
|
# information regarding copyright ownership.
|
||||||
|
|
||||||
. ./conf.sh
|
SYSTEMTESTTOP="$(realpath "$(dirname "$0")")"
|
||||||
$PERL start.pl "$@"
|
# shellcheck source=conf.sh
|
||||||
|
. "$SYSTEMTESTTOP/conf.sh"
|
||||||
|
export SYSTEMTESTTOP
|
||||||
|
|
||||||
|
$PERL "$SYSTEMTESTTOP/start.pl" "$@"
|
||||||
|
@@ -15,7 +15,10 @@
|
|||||||
# If a server is specified, stop it. Otherwise, stop all servers for test.
|
# If a server is specified, stop it. Otherwise, stop all servers for test.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Cwd 'abs_path';
|
use warnings;
|
||||||
|
|
||||||
|
use Cwd ':DEFAULT', 'abs_path';
|
||||||
|
use English '-no_match_vars';
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
@@ -35,61 +38,87 @@ my $usage = "usage: $0 [--use-rndc [--halt] [--port port]] test-directory [serve
|
|||||||
|
|
||||||
my $use_rndc = 0;
|
my $use_rndc = 0;
|
||||||
my $halt = 0;
|
my $halt = 0;
|
||||||
my $port = 9953;
|
my $rndc_port = 9953;
|
||||||
GetOptions('use-rndc' => \$use_rndc, 'halt' => \$halt, 'port=i' => \$port) or die "$usage\n";
|
|
||||||
|
|
||||||
my $errors = 0;
|
my $errors = 0;
|
||||||
|
|
||||||
my $test = $ARGV[0];
|
GetOptions(
|
||||||
my $server = $ARGV[1];
|
'use-rndc!' => \$use_rndc,
|
||||||
die "$usage\n" unless defined($test);
|
'halt!' => \$halt,
|
||||||
die "No test directory: \"$test\"\n" unless (-d $test);
|
'port=i' => \$rndc_port
|
||||||
die "No server directory: \"$server\"\n" if (defined($server) && !-d "$test/$server");
|
) or die "$usage\n";
|
||||||
|
|
||||||
|
my ( $test, $server_arg ) = @ARGV;
|
||||||
|
|
||||||
|
if (!$test) {
|
||||||
|
die "$usage\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Global variables
|
# Global variables
|
||||||
my $testdir = abs_path($test);
|
my $topdir = abs_path($ENV{'SYSTEMTESTTOP'});
|
||||||
my @servers;
|
my $testdir = abs_path($topdir . "/" . $test);
|
||||||
|
|
||||||
|
if (! -d $testdir) {
|
||||||
|
die "No test directory: \"$testdir\"\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Determine which servers need to be stopped.
|
if ($server_arg && ! -d "$testdir/$server_arg") {
|
||||||
if (defined $server) {
|
die "No server directory: \"$testdir/$server_arg\"\n";
|
||||||
@servers = ($server);
|
}
|
||||||
|
|
||||||
|
my $RNDC = $ENV{RNDC};
|
||||||
|
|
||||||
|
my @ns;
|
||||||
|
my @ans;
|
||||||
|
|
||||||
|
if ($server_arg) {
|
||||||
|
if ($server_arg =~ /^ns/) {
|
||||||
|
push(@ns, $server_arg);
|
||||||
|
} elsif ($server_arg =~ /^ans/) {
|
||||||
|
push(@ans, $server_arg);
|
||||||
|
} else {
|
||||||
|
print "$0: ns or ans directory expected";
|
||||||
|
print "I:$test:failed";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
local *DIR;
|
# Determine which servers need to be stopped for this test.
|
||||||
opendir DIR, $testdir or die "$testdir: $!\n";
|
opendir DIR, $testdir or die "unable to read test directory: \"$test\" ($OS_ERROR)\n";
|
||||||
my @files = sort readdir DIR;
|
my @files = sort readdir DIR;
|
||||||
closedir DIR;
|
closedir DIR;
|
||||||
|
|
||||||
my @ns = grep /^ns[0-9]*$/, @files;
|
@ns = grep /^ns[0-9]*$/, @files;
|
||||||
my @ans = grep /^ans[0-9]*$/, @files;
|
@ans = grep /^ans[0-9]*$/, @files;
|
||||||
|
|
||||||
push @servers, @ns, @ans;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Stop the server(s), pass 1: rndc.
|
# Stop the server(s), pass 1: rndc.
|
||||||
if ($use_rndc) {
|
if ($use_rndc) {
|
||||||
foreach my $server (grep /^ns/, @servers) {
|
foreach my $name(@ns) {
|
||||||
stop_rndc($server);
|
stop_rndc($name, $rndc_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_for_servers(30, grep /^ns/, @servers);
|
@ns = wait_for_servers(30, @ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Pass 2: SIGTERM
|
# Pass 2: SIGTERM
|
||||||
foreach my $server (@servers) {
|
foreach my $name (@ns) {
|
||||||
stop_signal($server, "TERM");
|
stop_signal($name, "TERM");
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_for_servers(60, @servers);
|
@ns = wait_for_servers(60, @ns);
|
||||||
|
|
||||||
|
foreach my $name(@ans) {
|
||||||
|
stop_signal($name, "TERM");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ans = wait_for_servers(60, @ans);
|
||||||
|
|
||||||
# Pass 3: SIGABRT
|
# Pass 3: SIGABRT
|
||||||
foreach my $server (@servers) {
|
foreach my $name (@ns, @ans) {
|
||||||
stop_signal($server, "ABRT");
|
print "I:$test:$name didn't die when sent a SIGTERM\n";
|
||||||
|
stop_signal($name, "ABRT");
|
||||||
|
$errors = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit($errors ? 1 : 0);
|
exit($errors);
|
||||||
|
|
||||||
# Subroutines
|
# Subroutines
|
||||||
|
|
||||||
@@ -97,26 +126,24 @@ exit($errors ? 1 : 0);
|
|||||||
sub server_pid_file {
|
sub server_pid_file {
|
||||||
my($server) = @_;
|
my($server) = @_;
|
||||||
|
|
||||||
my $pid_file;
|
return $testdir . "/" . $server . "/named.pid" if ($server =~ /^ns/);
|
||||||
if ($server =~ /^ns/) {
|
return $testdir . "/" . $server . "/ans.pid" if ($server =~ /^ans/);
|
||||||
$pid_file = "named.pid";
|
|
||||||
} elsif ($server =~ /^ans/) {
|
die "Unknown server type $server\n";
|
||||||
$pid_file = "ans.pid";
|
|
||||||
} else {
|
|
||||||
print "I:Unknown server type $server\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
$pid_file = "$testdir/$server/$pid_file";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read a PID.
|
# Read a PID.
|
||||||
sub read_pid {
|
sub read_pid {
|
||||||
my($pid_file) = @_;
|
my ( $server ) = @_;
|
||||||
|
|
||||||
|
my $pid_file = server_pid_file($server);
|
||||||
|
|
||||||
|
return unless -f $pid_file;
|
||||||
|
|
||||||
local *FH;
|
local *FH;
|
||||||
my $result = open FH, "< $pid_file";
|
my $result = open FH, "< $pid_file";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
print "I:$pid_file: $!\n";
|
print "I:$test:$pid_file: $!\n";
|
||||||
unlink $pid_file;
|
unlink $pid_file;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -128,47 +155,43 @@ sub read_pid {
|
|||||||
|
|
||||||
# Stop a named process with rndc.
|
# Stop a named process with rndc.
|
||||||
sub stop_rndc {
|
sub stop_rndc {
|
||||||
my($server) = @_;
|
my ( $server, $port ) = @_;
|
||||||
|
my $n;
|
||||||
|
|
||||||
return unless ($server =~ /^ns(\d+)$/);
|
if ($server =~ /^ns(\d+)/) {
|
||||||
my $ip = "10.53.0.$1";
|
$n = $1;
|
||||||
|
} else {
|
||||||
|
die "unable to parse server number from name \"$server\"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $ip = "10.53.0.$n";
|
||||||
my $how = $halt ? "halt" : "stop";
|
my $how = $halt ? "halt" : "stop";
|
||||||
|
|
||||||
# Ugly, but should work.
|
# Ugly, but should work.
|
||||||
system("$ENV{RNDC} -c ../common/rndc.conf -s $ip -p $port $how | sed 's/^/I:$server /'");
|
system("$RNDC -c ../common/rndc.conf -s $ip -p $port $how | sed 's/^/I:$test:$server /'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop a server by sending a signal to it.
|
# Stop a server by sending a signal to it.
|
||||||
sub stop_signal {
|
sub stop_signal {
|
||||||
my($server, $sig) = @_;
|
my($server, $signal) = @_;
|
||||||
|
|
||||||
my $pid_file = server_pid_file($server);
|
my $pid = read_pid($server);
|
||||||
return unless -f $pid_file;
|
|
||||||
|
|
||||||
my $pid = read_pid($pid_file);
|
|
||||||
return unless defined($pid);
|
return unless defined($pid);
|
||||||
|
|
||||||
if ($sig eq 'ABRT') {
|
my $result;
|
||||||
print "I:$server didn't die when sent a SIGTERM\n";
|
my $pid_file = server_pid_file($server);
|
||||||
$errors++;
|
|
||||||
|
if ($^O eq 'cygwin') {
|
||||||
|
$result = !system("/bin/kill -f -$signal $pid");
|
||||||
|
} else {
|
||||||
|
$result = kill $signal, $pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $result;
|
|
||||||
if ($^O eq 'cygwin') {
|
|
||||||
$result = system("/bin/kill -f -$sig $pid");
|
|
||||||
unlink $pid_file;
|
|
||||||
if ($result != 0) {
|
|
||||||
print "I:$test:$server died before a SIG$sig was sent\n";
|
|
||||||
$errors++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result = kill $sig, $pid;
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
print "I:$test:$server died before a SIG$sig was sent\n";
|
print "I:$test:$server died before a SIG$signal was sent\n";
|
||||||
|
$errors = 1;
|
||||||
unlink $pid_file;
|
unlink $pid_file;
|
||||||
$errors++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -177,14 +200,11 @@ sub stop_signal {
|
|||||||
sub wait_for_servers {
|
sub wait_for_servers {
|
||||||
my($timeout, @servers) = @_;
|
my($timeout, @servers) = @_;
|
||||||
|
|
||||||
my @pid_files = grep { defined($_) }
|
while ($timeout > 0 && @servers > 0) {
|
||||||
map { server_pid_file($_) } @servers;
|
@servers = grep { -f server_pid_file($_) } @servers;
|
||||||
|
sleep 1 if (@servers > 0);
|
||||||
while ($timeout > 0 && @pid_files > 0) {
|
|
||||||
@pid_files = grep { -f $_ } @pid_files;
|
|
||||||
sleep 1 if (@pid_files > 0);
|
|
||||||
$timeout--;
|
$timeout--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return @servers;
|
||||||
}
|
}
|
||||||
|
7
bin/tests/system/stop.sh
Normal file → Executable file
7
bin/tests/system/stop.sh
Normal file → Executable file
@@ -9,6 +9,9 @@
|
|||||||
# See the COPYRIGHT file distributed with this work for additional
|
# See the COPYRIGHT file distributed with this work for additional
|
||||||
# information regarding copyright ownership.
|
# information regarding copyright ownership.
|
||||||
|
|
||||||
. ./conf.sh
|
SYSTEMTESTTOP="$(realpath "$(dirname "$0")")"
|
||||||
$PERL ./stop.pl "$@"
|
# shellcheck source=conf.sh
|
||||||
|
. "$SYSTEMTESTTOP/conf.sh"
|
||||||
|
export SYSTEMTESTTOP
|
||||||
|
|
||||||
|
$PERL "$SYSTEMTESTTOP/stop.pl" "$@"
|
||||||
|
@@ -53,10 +53,10 @@ digcomp knowngood.dig.out.rec dig.out.ns3 || ret=1
|
|||||||
|
|
||||||
[ $pass = 1 ] && {
|
[ $pass = 1 ] && {
|
||||||
echo_i "stopping stub server"
|
echo_i "stopping stub server"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl stub ns3
|
||||||
|
|
||||||
echo_i "re-starting stub server"
|
echo_i "re-starting stub server"
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} stub ns3
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@@ -136,8 +136,8 @@ $DIFF -s large.out dig.out > /dev/null || { ret=1 ; echo_i "$DIFF failed"; }
|
|||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
echo_i "stop and restart slave"
|
echo_i "stop and restart slave"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns2
|
$PERL $SYSTEMTESTTOP/stop.pl unknown ns2
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} unknown ns2
|
||||||
|
|
||||||
echo_i "checking large unknown record loading on slave"
|
echo_i "checking large unknown record loading on slave"
|
||||||
ret=0
|
ret=0
|
||||||
@@ -154,8 +154,8 @@ $DIFF large.out dig.out > /dev/null || { ret=1 ; echo_i "$DIFF failed"; }
|
|||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
echo_i "stop and restart inline slave"
|
echo_i "stop and restart inline slave"
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl unknown ns3
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} unknown ns3
|
||||||
|
|
||||||
echo_i "checking large unknown record loading on inline slave"
|
echo_i "checking large unknown record loading on inline slave"
|
||||||
ret=0
|
ret=0
|
||||||
|
@@ -429,8 +429,8 @@ echo_i "test mapped zone with out of zone data ($n)"
|
|||||||
tmp=0
|
tmp=0
|
||||||
$DIG -p ${PORT} txt mapped @10.53.0.3 > dig.out.1.$n
|
$DIG -p ${PORT} txt mapped @10.53.0.3 > dig.out.1.$n
|
||||||
grep "status: NOERROR," dig.out.1.$n > /dev/null || tmp=1
|
grep "status: NOERROR," dig.out.1.$n > /dev/null || tmp=1
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns3
|
$PERL $SYSTEMTESTTOP/stop.pl xfer ns3
|
||||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns3
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} xfer ns3
|
||||||
$DIG -p ${PORT} txt mapped @10.53.0.3 > dig.out.2.$n
|
$DIG -p ${PORT} txt mapped @10.53.0.3 > dig.out.2.$n
|
||||||
grep "status: NOERROR," dig.out.2.$n > /dev/null || tmp=1
|
grep "status: NOERROR," dig.out.2.$n > /dev/null || tmp=1
|
||||||
$DIG -p ${PORT} axfr mapped @10.53.0.3 > dig.out.3.$n
|
$DIG -p ${PORT} axfr mapped @10.53.0.3 > dig.out.3.$n
|
||||||
|
Reference in New Issue
Block a user