- Die PID des Test-Servers wird nun mit dem Script "getpid.sh" ermittelt.
This commit is contained in:
parent
90ab7c7c48
commit
efedfe12ff
|
@ -9,7 +9,7 @@
|
|||
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
#
|
||||
# $Id: Makefile.am,v 1.3 2002/09/12 02:26:17 alex Exp $
|
||||
# $Id: Makefile.am,v 1.4 2002/09/20 14:46:55 alex Exp $
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = ../portab/ansi2knr
|
||||
|
@ -17,6 +17,7 @@ AUTOMAKE_OPTIONS = ../portab/ansi2knr
|
|||
INCLUDES = -I$(srcdir)/../portab
|
||||
|
||||
EXTRA_DIST = \
|
||||
getpid.sh \
|
||||
start-server.sh stop-server.sh tests.sh stress-server.sh \
|
||||
connect-test.e channel-test.e mode-test.e \
|
||||
stress-A.e stress-B.e check-idle.e \
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
# $Id: getpid.sh,v 1.1 2002/09/20 14:46:55 alex Exp $
|
||||
|
||||
# wurde ein Name uebergeben?
|
||||
[ $# -ne 1 ] && exit 1
|
||||
|
||||
# Flags fuer "ps" ermitteln
|
||||
if [ `uname` = "FreeBSD" ]; then
|
||||
PS_FLAGS=-a; PS_PIDCOL=1
|
||||
else
|
||||
PS_FLAGS=-f; PS_PIDCOL=2
|
||||
ps $PS_FLAGS > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then PS_FLAGS=a; PS_PIDCOL=1; fi
|
||||
fi
|
||||
|
||||
# PID ermitteln
|
||||
ps $PS_FLAGS > procs.tmp
|
||||
pid=`cat procs.tmp | grep "$1" | awk "{ print \\\$$PS_PIDCOL }" | sort -n | head -n 1`
|
||||
|
||||
# ermittelte PID validieren
|
||||
[ "$pid" -gt 1 ] > /dev/null 2>&1
|
||||
[ $? -ne 0 ] && exit 1
|
||||
|
||||
echo $pid
|
||||
exit 0
|
||||
|
||||
# -eof-
|
|
@ -1,22 +1,30 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
# $Id: start-server.sh,v 1.7 2002/09/20 13:57:01 alex Exp $
|
||||
# $Id: start-server.sh,v 1.8 2002/09/20 14:46:55 alex Exp $
|
||||
|
||||
echo " starting server ..."
|
||||
|
||||
rm -rf logs
|
||||
# alte Logfiles loeschen
|
||||
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!
|
||||
./getpid.sh make > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " error: getpid.sh FAILED!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# MOTD fuer Test-Server erzeugen
|
||||
echo "This is an ngIRCd Test Server" > ngircd-test.motd
|
||||
|
||||
# Test-Server starten ...
|
||||
./ngircd-TEST -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 &
|
||||
sleep 1
|
||||
|
||||
PS_FLAGS=-f; PS_PIDCOL=2
|
||||
ps $PS_FLAGS > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then PS_FLAGS=a; PS_PIDCOL=1; fi
|
||||
|
||||
ps $PS_FLAGS > procs.tmp
|
||||
pid=`cat procs.tmp | grep ngircd-TEST | awk "{ print \\\$$PS_PIDCOL }"`
|
||||
# validieren, dass Server laeuft
|
||||
pid=`./getpid.sh ngircd-TEST`
|
||||
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
|
||||
|
||||
# -eof-
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
# $Id: stop-server.sh,v 1.6 2002/09/20 13:57:01 alex Exp $
|
||||
# $Id: stop-server.sh,v 1.7 2002/09/20 14:46:55 alex Exp $
|
||||
|
||||
echo " stopping server ..."
|
||||
|
||||
PS_FLAGS=-f; PS_PIDCOL=2
|
||||
ps $PS_FLAGS > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then PS_FLAGS=a; PS_PIDCOL=1; fi
|
||||
# Test-Server stoppen ...
|
||||
pid=`./getpid.sh ngircd-TEST`
|
||||
[ -n "$pid" ] && kill $pid > /dev/null 2>&1 || exit 1
|
||||
sleep 1
|
||||
|
||||
ps $PS_FLAGS > procs.tmp
|
||||
pid=`cat procs.tmp | grep ngircd-TEST | awk "{ print \\\$$PS_PIDCOL }"`
|
||||
[ -n "$pid" ] && kill -0 $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
|
||||
|
||||
# -eof-
|
||||
|
|
Loading…
Reference in New Issue