Enhanced messages and exit codes.

This commit is contained in:
Alexander Barton 2004-09-04 19:14:46 +00:00
parent aa26e2ef36
commit c5bdd86f96
5 changed files with 34 additions and 18 deletions

View File

@ -1,10 +1,10 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: start-server.sh,v 1.12 2004/09/04 13:58:31 alex Exp $
# $Id: start-server.sh,v 1.13 2004/09/04 19:14:46 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
echo " starting server ..."
echo -n " starting server ..."
# remove old logfiles
rm -rf logs *.log
@ -13,14 +13,14 @@ rm -rf logs *.log
# test-server, because we won't be able to kill it at the end of the test.
./getpid.sh sh > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo " error: getpid.sh FAILED!"
echo " getpid.sh failed!"
exit 1
fi
# check if there is a test-server already running
./getpid.sh T-ngircd > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo " error: test-server already running!"
echo " failure: test-server already running!"
exit 1
fi
@ -33,6 +33,9 @@ sleep 1
# validate running test-server
pid=`./getpid.sh T-ngircd`
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$?
[ $r -eq 0 ] && echo " ok." || echo " failure!"
exit
# -eof-

View File

@ -1,25 +1,29 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: stop-server.sh,v 1.10 2003/08/22 11:31:18 alex Exp $
# $Id: stop-server.sh,v 1.11 2004/09/04 19:14:46 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
echo " stopping server ..."
echo -n " stopping server ..."
# stop test-server ...
pid=`./getpid.sh T-ngircd`
if [ -z "$pid" ]; then
echo " no running server found!?"
echo " failure: no running server found!?"
exit 1
fi
kill $pid > /dev/null 2>&1 || exit 1
# waiting ...
for i in 1 2 3 4 5; do
kill -0 $pid > /dev/null 2>&1 || exit 0
kill -0 $pid > /dev/null 2>&1; r=$?
if [ $r -eq 0 ]; then
echo " ok".
exit 0
fi
sleep 1
done
echo " server still running!?"
echo " failure: server still running!?"
exit 1
# -eof-

View File

@ -9,7 +9,7 @@
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: stress-server.sh,v 1.13 2004/09/04 18:20:16 alex Exp $
# $Id: stress-server.sh,v 1.14 2004/09/04 19:14:46 alex Exp $
#
# detect source directory
@ -69,7 +69,7 @@ while true; do
echo -n "."
done
[ $res -eq 0 ] && echo " done." || echo " ERROR!"
[ $res -eq 0 ] && echo " ok." || echo " failure!"
exit $res

View File

@ -9,7 +9,7 @@
# (at your option) any later version.
# Please read the file COPYING, README and AUTHORS for more information.
#
# $Id: test-loop.sh,v 1.1 2004/09/04 15:44:45 alex Exp $
# $Id: test-loop.sh,v 1.2 2004/09/04 19:14:46 alex Exp $
#
# detect source directory
@ -22,9 +22,10 @@
loop=0
while [ ${loop} -lt $LOOPS ]; do
loop=`expr ${loop} + 1`
echo " loop $loop/$LOOPS starting ..."
echo " loop $loop/$LOOPS starting:"
for s in $srcdir/*-test; do
sh $s
sh $s; r=$?
[ $r -ne 0 ] && exit $r
sleep 1
done
if [ ${loop} -lt $LOOPS ]; then

View File

@ -1,6 +1,6 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: tests.sh,v 1.5 2004/09/04 14:22:38 alex Exp $
# $Id: tests.sh,v 1.6 2004/09/04 19:14:46 alex Exp $
# detect source directory
[ -z "$srcdir" ] && srcdir=`dirname $0`
@ -9,6 +9,11 @@ name=`basename $0`
test=`echo ${name} | cut -d '.' -f 1`
mkdir -p logs
if [ ! -r "$test" ]; then
echo " ${name}: test \"$test\" not found!"; exit 77
exit 1
fi
type expect > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo " ${name}: \"expect\" not found."; exit 77
@ -18,7 +23,10 @@ if [ $? -ne 0 ]; then
echo " ${name}: \"telnet\" not found."; exit 77
fi
echo " doing ${test} ..."
expect ${srcdir}/${test}.e > logs/${test}.log
echo -n " running ${test} ..."
expect ${srcdir}/${test}.e > logs/${test}.log 2>&1; r=$?
[ $r -eq 0 ] && echo " ok." || echo " failure!"
exit $r
# -eof-