From: Mark Andrews Date: Thu, 8 May 2014 01:10:04 +0000 (+1000) Subject: address suspected race in system test for 'named -L' X-Git-Tag: v9.11.0a1~1657 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=151759e7b74ba6c8ea1c92fb513633ac7c2bb0f3;p=thirdparty%2Fbind9.git address suspected race in system test for 'named -L' --- diff --git a/bin/tests/system/logfileconfig/tests.sh b/bin/tests/system/logfileconfig/tests.sh index 95d24d6ee73..4fa24cc973e 100644 --- a/bin/tests/system/logfileconfig/tests.sh +++ b/bin/tests/system/logfileconfig/tests.sh @@ -34,6 +34,14 @@ PIDFILE="${THISDIR}/${CONFDIR}/named.pid" myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf" myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -U 4" +waitforpidfile() { + for _w in 1 2 3 4 5 6 7 8 9 10 + do + test -f $PIDFILE && break + sleep 1 + done +} + status=0 cd $CONFDIR @@ -233,20 +241,28 @@ status=0 # Now stop the server again and test the -L option rm -f $DLFILE -$myRNDC stop -cp $PLAINCONF named.conf -$myNAMED -L $DLFILE > /dev/null 2>&1 -if [ $? -ne 0 ]; then - echo "I:failed to start $myNAMED" - echo "I:exit status: $status" - exit $status -fi +$PERL ../../stop.pl .. ns1 +if ! test -f $PIDFILE; then + cp $PLAINCONF named.conf + $myNAMED -L $DLFILE > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "I:failed to start $myNAMED" + echo "I:exit status: $status" + exit $status + fi + + waitforpidfile -sleep 1 -if [ -f "$DLFILE" ]; then - echo "I: testing default logfile using named -L succeeded" + sleep 1 + if [ -f "$DLFILE" ]; then + echo "I: testing default logfile using named -L succeeded" + else + echo "I:testing default logfile using named -L failed" + echo "I:exit status: 1" + exit 1 + fi else - echo "I:testing default logfile using named -L failed" + echo "I:failed to cleanly stop $myNAMED" echo "I:exit status: 1" exit 1 fi