- EXTRA_DIST ergaenzt, clean-Target erweitert.

- neues Script "stress-server.sh" integriert.
This commit is contained in:
Alexander Barton 2002-09-09 22:56:07 +00:00
parent d040fa2a7d
commit fc6f64742c
7 changed files with 171 additions and 6 deletions

View File

@ -9,17 +9,21 @@
# 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.1 2002/09/09 10:16:24 alex Exp $
# $Id: Makefile.am,v 1.2 2002/09/09 22:56:07 alex Exp $
#
AUTOMAKE_OPTIONS = ../portab/ansi2knr
INCLUDES = -I$(srcdir)/../portab
EXTRA_DIST = ngircd-test.conf connect-test.e channel-test.e mode-test.e
EXTRA_DIST = \
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
ngircd-test.conf
clean-local:
rm -f *.log *-test
rm -rf logs tests *-test ngircd-test.log ngircd-test.motd
maintainer-clean-local:
rm -f Makefile Makefile.in
@ -39,6 +43,7 @@ TESTS = start-server.sh \
connect-test \
channel-test \
mode-test \
stress-server.sh \
stop-server.sh
# -eof-

View File

@ -0,0 +1,31 @@
# $Id: check-idle.e,v 1.1 2002/09/09 22:56:07 alex Exp $
spawn telnet localhost 6789
expect {
timeout { exit 1 }
"Connected"
}
send "nick IdleTest\r"
send "user idle . . :Idle-Test\r"
expect {
timeout { exit 1 }
"376"
}
send "lusers\r"
expect {
timeout { exit 1 }
"251 IdleTest :There are 1 users and 0 services on 1 servers" { set r 0 }
"251 IdleTest :There are" { set r 99 }
}
send "quit\r"
expect {
timeout { exit 1 }
"Connection closed"
}
exit $r
# -eof-

View File

@ -1,6 +1,6 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: start-server.sh,v 1.1 2002/09/09 10:16:24 alex Exp $
# $Id: start-server.sh,v 1.2 2002/09/09 22:56:07 alex Exp $
echo " starting server ..."
@ -12,4 +12,6 @@ sleep 1
pid=`ps a | grep ngircd-test | head -n 1 | cut -d ' ' -f 1`
kill -0 $pid > /dev/null 2>&1
rm -rf logs
# -eof-

9
src/testsuite/stress-A.e Normal file
View File

@ -0,0 +1,9 @@
# $Id: stress-A.e,v 1.1 2002/09/09 22:56:07 alex Exp $
spawn telnet localhost 6789
expect {
timeout { exit 1 }
"Connected"
}
# -eof-

69
src/testsuite/stress-B.e Normal file
View File

@ -0,0 +1,69 @@
# $Id: stress-B.e,v 1.1 2002/09/09 22:56:07 alex Exp $
send "user user . . :User\r"
expect {
timeout { exit 1 }
"376"
}
send "oper TestOp 123\r"
expect {
timeout { exit 1 }
"MODE test* :+o"
}
expect {
timeout { exit 1 }
"381 test*"
}
send "join #channel\r"
expect {
timeout { exit 1 }
":test*!~user@* JOIN :#channel"
}
expect {
timeout { exit 1 }
"366"
}
send "mode #channel\r"
expect {
timeout { exit 1 }
"324 test* #channel"
}
send "join #channel2\r"
expect {
timeout { exit 1 }
":test*!~user@* JOIN :#channel2"
}
expect {
timeout { exit 1 }
"366"
}
send "names\r"
expect {
timeout { exit 1 }
"366"
}
send "part #channel2\r"
expect {
timeout { exit 1 }
":test*!~user@* PART #channel2"
}
send "part #channel\r"
expect {
timeout { exit 1 }
":test*!~user@* PART #channel"
}
send "quit\r"
expect {
timeout { exit 1 }
"Connection closed"
}
# -eof-

44
src/testsuite/stress-server.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: stress-server.sh,v 1.1 2002/09/09 22:56:07 alex Exp $
CLIENTS=50
name=`basename $0`
test=`echo ${name} | cut -d '.' -f 1`
mkdir -p logs tests
type expect > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "SKIP: ${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
fi
echo " stressing server with $CLIENTS clients (be patient!) ..."
no=0
while [ ${no} -lt $CLIENTS ]; do
cat stress-A.e > tests/${no}.e
echo "send \"nick test${no}\\r\"" >> tests/${no}.e
cat stress-B.e >> tests/${no}.e
no=`expr ${no} + 1`
done
no=0
while [ ${no} -lt $CLIENTS ]; do
expect tests/${no}.e > logs/stress-${no}.log 2> /dev/null &
no=`expr ${no} + 1`
done
touch logs/check-idle.log
while true; do
expect check-idle.e >> logs/check-idle.log
res=$?
[ $res -eq 0 ] && exit 0
[ $res -eq 1 ] && exit 1
sleep 1
echo "====================" >> logs/check-idle.log
done
# -eof-

View File

@ -1,16 +1,21 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: tests.sh,v 1.1 2002/09/09 10:16:24 alex Exp $
# $Id: tests.sh,v 1.2 2002/09/09 22:56:07 alex Exp $
name=`basename $0`
test=`echo ${name} | cut -d '.' -f 1`
mkdir -p logs
type expect > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "SKIP: ${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
fi
echo " doing ${test} ..."
expect ${test}.e > ${test}.log
expect ${test}.e > logs/${test}.log
# -eof-