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.
This commit is contained in:
Brian Wellington
2000-07-12 17:59:08 +00:00
parent f83bad6f78
commit 9df4200a67
2 changed files with 50 additions and 10 deletions
+25 -5
View 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.22 2000/07/07 18:25:13 bwelling Exp $
# $Id: tests.sh,v 1.23 2000/07/12 17:59:07 bwelling 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
+25 -5
View 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.12 2000/07/09 15:55:01 tale Exp $
# $Id: stop.sh,v 1.13 2000/07/12 17:59:08 bwelling 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