]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorAndreas Gustafsson <source@isc.org>
Wed, 12 Jul 2000 18:02:32 +0000 (18:02 +0000)
committerAndreas Gustafsson <source@isc.org>
Wed, 12 Jul 2000 18:02:32 +0000 (18:02 +0000)
Check the return value of kill.  This means that the test can now detect
the case when a program no longer exists (due to a crash) or when a
program responds badly to a SIGTERM and doesn't clean up the pid file.

bin/tests/system/notify/tests.sh
bin/tests/system/stop.sh

index f5fe6f8c201a146870d6e5a9cbd607870a50a4e7..eedb5ea0b8ae661e6def8b38a2365e8aac551791 100644 (file)
@@ -15,7 +15,7 @@
 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 # SOFTWARE.
 
-# $Id: tests.sh,v 1.16.2.1 2000/07/10 04:52:04 gson Exp $
+# $Id: tests.sh,v 1.16.2.2 2000/07/12 18:02:32 gson Exp $
 
 #
 # Perform tests
@@ -52,14 +52,24 @@ grep ";" dig.out.ns3
 
 $PERL ../digcomp.pl dig.out.ns2 dig.out.ns3 || status=1
 
-kill -TERM `cat ns3/named.pid`
+kill -TERM `cat ns3/named.pid` > /dev/null 2>&1
+if [ $? != 0 ]; then
+       echo "I:ns3 died before a SIGTERM was sent"
+       status=1
+       rm -f ns3/named.pid
+fi
 rm -f ns2/example.db
 cp ns2/example3.db ns2/example.db
 sleep 6
 
 if [ -f ns3/named.pid ]; then
        echo "I:ns3 didn't die when sent a SIGTERM"
-       kill -KILL `cat ns3/named.pid`
+       kill -KILL `cat ns3/named.pid` > /dev/null 2>&1
+       if [ $? != 0 ]; then
+               echo "I:ns3 died before a SIGKILL was sent"
+               status=1
+               rm -f ns3/named.pid
+       fi
        status=1
 fi
 
@@ -78,12 +88,22 @@ grep ";" dig.out.ns3
 $PERL ../digcomp.pl dig.out.ns2 dig.out.ns3 || status=1
 
 rm -f ns2/example.db
-kill -TERM `cat ns2/named.pid`
+kill -TERM `cat ns2/named.pid` > /dev/null 2>&1
+if [ $? != 0 ]; then
+       echo "I:ns2 died before a SIGTERM was sent"
+       status=1
+       rm -f ns2/named.pid
+fi
 sleep 6
 
 if [ -f ns2/named.pid ]; then
        echo "I:ns2 didn't die when sent a SIGTERM"
-       kill -KILL `cat ns2/named.pid`
+       kill -KILL `cat ns2/named.pid` > /dev/null 2>&1
+       if [ $? != 0 ]; then
+               echo "I:ns2 died before a SIGKILL was sent"
+               status=1
+               rm -f ns2/named.pid
+       fi
        status=1
 fi
 
index a02d26c44f7db9011adb8de761f7e5c31439b68e..4febbc407e81fae2786afa0b07201ac41589fc24 100644 (file)
@@ -15,7 +15,7 @@
 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 # SOFTWARE.
 
-# $Id: stop.sh,v 1.8.2.1 2000/07/10 04:51:50 gson Exp $
+# $Id: stop.sh,v 1.8.2.2 2000/07/12 18:02:29 gson Exp $
 
 #
 # Stop name servers.
@@ -31,7 +31,12 @@ for d in ns*
 do
      pidfile="$d/named.pid"
      if [ -f $pidfile ]; then
-        kill -TERM `cat $pidfile`
+        kill -TERM `cat $pidfile` > /dev/null 2>&1
+       if [ $? != 0 ]; then
+               echo "I:$d died before a SIGTERM was sent"
+               status=`expr $status + 1`
+               rm -f $pidfile
+       fi
      fi
 done
 
@@ -39,7 +44,12 @@ for d in lwresd*
 do
      pidfile="$d/lwresd.pid"
      if [ -f $pidfile ]; then
-        kill -TERM `cat $pidfile`
+        kill -TERM `cat $pidfile` > /dev/null 2>&1
+       if [ $? != 0 ]; then
+               echo "I:$d died before a SIGTERM was sent"
+               status=`expr $status + 1`
+               rm -f $pidfile
+       fi
      fi
 done
 
@@ -51,7 +61,12 @@ do
      if [ -f $pidfile ]; then
        echo "I:$d didn't die when sent a SIGTERM"
        status=`expr $status + 1`
-        kill -KILL `cat $pidfile`
+        kill -KILL `cat $pidfile` > /dev/null 2>&1
+       if [ $? != 0 ]; then
+               echo "I:$d died before a SIGKILL was sent"
+               status=`expr $status + 1`
+               rm -f $pidfile
+       fi
         rm -f $pidfile
      fi
 done
@@ -62,7 +77,12 @@ do
      if [ -f $pidfile ]; then
        echo "I:$d didn't die when sent a SIGTERM"
        status=`expr $status + 1`
-        kill -KILL `cat $pidfile`
+        kill -KILL `cat $pidfile` > /dev/null 2>&1
+       if [ $? != 0 ]; then
+               echo "I:$d died before a SIGKILL was sent"
+               status=`expr $status + 1`
+               rm -f $pidfile
+       fi
         rm -f $pidfile
      fi
 done