commit - 5e4124d38df21bb0408b67be071a0d6eddbe0233
commit + 1ed708ef39f41436797754829fd574f34f8a3a71
blob - 57d5962578c6455e095e2a0b6ba6783c33c8f5b0
blob + 17d717494fe6f833db31629e210e59d67737d183
--- src/testsuite/getpid.sh
+++ src/testsuite/getpid.sh
#!/bin/sh
# ngIRCd Test Suite
-# $Id: getpid.sh,v 1.3 2003/04/22 19:27:50 alex Exp $
+# $Id: getpid.sh,v 1.4 2003/08/22 11:31:18 alex Exp $
-# wurde ein Name uebergeben?
+# did we get a name?
[ $# -ne 1 ] && exit 1
-# Flags fuer "ps" ermitteln
+# detect flags for "ps" and "head"
if [ `uname` = "FreeBSD" ]; then
PS_FLAGS="-a"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1"
elif [ `uname` = "A/UX" ]; then
PS_FLAGS="-ae"; PS_PIDCOL="1"; HEAD_FLAGS="-1"
+elif [ `uname` = "GNU" ]; then
+ PS_FLAGS="-ax"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1"
else
PS_FLAGS="-f"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1"
ps $PS_FLAGS > /dev/null 2>&1
if [ $? -ne 0 ]; then PS_FLAGS="a"; PS_PIDCOL="1"; fi
fi
-# PID ermitteln
+# debug output
+#echo "$0: PS_FLAGS=$PS_FLAGS"
+#echo "$0: PS_PIDCOL=$PS_PIDCOL"
+#echo "$0: HEAD_FLAGS=$HEAD_FLAGS"
+
+# search PID
ps $PS_FLAGS > procs.tmp
-cat procs.tmp | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n > pids.tmp
+cat procs.tmp | grep -v "$0" | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n > pids.tmp
pid=`head $HEAD_FLAGS pids.tmp`
rm -rf procs.tmp pids.tmp
-# ermittelte PID validieren
+# validate PID
[ "$pid" -gt 1 ] > /dev/null 2>&1
[ $? -ne 0 ] && exit 1
blob - b342dedbb4ea4c3182e1181d2c5303c75877f38c
blob + 3bbbe44547b728b5ed84946152da7ee22bdacdfa
--- src/testsuite/start-server.sh
+++ src/testsuite/start-server.sh
#!/bin/sh
# ngIRCd Test Suite
-# $Id: start-server.sh,v 1.10 2002/11/10 14:28:06 alex Exp $
+# $Id: start-server.sh,v 1.11 2003/08/22 11:31:18 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
echo " starting server ..."
-# alte Logfiles loeschen
+# remove old logfiles
rm -rf logs *.log
-# pruefen, ob getpid.sh gueltige PID's liefert. Wenn dem nicht so ist,
-# wird kein ngIRCd gestartet, da dieser ansonsten nicht mehr am Ende
-# des Testlaufs beendet werden koennte!
+# check weather getpid.sh returns valid PIDs. If not, don't start up the
+# 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!"
exit 1
fi
-# MOTD fuer Test-Server erzeugen
+# 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!"
+ exit 1
+fi
+
+# generate MOTD for test-server
echo "This is an ngIRCd Test Server" > ngircd-test.motd
-# Test-Server starten ...
+# starting up test-server ...
./T-ngircd -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 &
sleep 1
-# validieren, dass Server laeuft
+# validate running test-server
pid=`./getpid.sh T-ngircd`
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
blob - a9cce99f87760f4a4f44d6c358efeac853dae654
blob + d76871b88175e63755189a1ce3f9dbf31ccb3a22
--- src/testsuite/stop-server.sh
+++ src/testsuite/stop-server.sh
#!/bin/sh
# ngIRCd Test Suite
-# $Id: stop-server.sh,v 1.9 2002/11/10 14:28:06 alex Exp $
+# $Id: stop-server.sh,v 1.10 2003/08/22 11:31:18 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
echo " stopping server ..."
-# Test-Server stoppen ...
+# stop test-server ...
pid=`./getpid.sh T-ngircd`
-[ -n "$pid" ] && kill $pid > /dev/null 2>&1 || exit 1
-sleep 1
+if [ -z "$pid" ]; then
+ echo " no running server found!?"
+ exit 1
+fi
+kill $pid > /dev/null 2>&1 || exit 1
-# jetzt duerfte der Prozess nicht mehr laufen
-kill -0 $pid > /dev/null 2>&1 && exit 1 || exit 0
+# waiting ...
+for i in 1 2 3 4 5; do
+ kill -0 $pid > /dev/null 2>&1 || exit 0
+ sleep 1
+done
+echo " server still running!?"
+exit 1
# -eof-
blob - 51e56da1cb1e1012df5e75746ea6ae9625562724
blob + df0969b4d9353978feb602ad92f3a590344f8b22
--- src/testsuite/stress-server.sh
+++ src/testsuite/stress-server.sh
#!/bin/sh
# ngIRCd Test Suite
-# $Id: stress-server.sh,v 1.7 2003/04/22 19:27:50 alex Exp $
+# $Id: stress-server.sh,v 1.8 2003/08/22 11:31:18 alex Exp $
[ -z "$srcdir" ] && srcdir=`dirname $0`
type expect > /dev/null 2>&1
if [ $? -ne 0 ]; then
- echo "SKIP: ${name} -- \"expect\" not found."; exit 77
+ echo " ${name}: \"expect\" not found."; exit 77
fi
type telnet > /dev/null 2>&1
if [ $? -ne 0 ]; then
- echo "SKIP: ${name} -- \"telnet\" not found."; exit 77
+ echo " ${name}: \"telnet\" not found."; exit 77
fi
echo " stressing server with $CLIENTS clients (be patient!) ..."
blob - 597dd08ce258807beef4984cd53417b86e4004d6
blob + 401a55da8b057cd975acab61c73a2dbe99cfeae3
--- src/testsuite/tests.sh
+++ src/testsuite/tests.sh
#!/bin/sh
# ngIRCd Test Suite
-# $Id: tests.sh,v 1.3 2002/09/12 02:29:03 alex Exp $
+# $Id: tests.sh,v 1.4 2003/08/22 11:31:18 alex Exp $
name=`basename $0`
test=`echo ${name} | cut -d '.' -f 1`
type expect > /dev/null 2>&1
if [ $? -ne 0 ]; then
- echo "SKIP: ${name} -- \"expect\" not found."; exit 77
+ echo " ${name}: \"expect\" not found."; exit 77
fi
type telnet > /dev/null 2>&1
if [ $? -ne 0 ]; then
- echo "SKIP: ${name} -- \"telnet\" not found."; exit 77
+ echo " ${name}: \"telnet\" not found."; exit 77
fi
echo " doing ${test} ..."