mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 09:50:29 +00:00
Enhanced testsuite, should run under GNU/Hurd now.
This commit is contained in:
parent
5e4124d38d
commit
1ed708ef39
@ -1,28 +1,35 @@
|
||||
#!/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
|
||||
|
||||
|
@ -1,31 +1,37 @@
|
||||
#!/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
|
||||
|
||||
|
@ -1,17 +1,25 @@
|
||||
#!/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-
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/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`
|
||||
|
||||
@ -12,11 +12,11 @@ mkdir -p logs tests
|
||||
|
||||
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!) ..."
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/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`
|
||||
@ -8,11 +8,11 @@ mkdir -p logs
|
||||
|
||||
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} ..."
|
||||
|
Loading…
Reference in New Issue
Block a user