- Test-Suite fuer den ngIRCd begonnen.

This commit is contained in:
Alexander Barton 2002-09-09 10:16:24 +00:00
parent dd4535b7f1
commit c4d78a3469
8 changed files with 153 additions and 0 deletions

44
src/testsuite/Makefile.am Normal file
View File

@ -0,0 +1,44 @@
#
# ngIRCd -- The Next Generation IRC Daemon
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
#
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
# der GNU General Public License (GPL), wie von der Free Software Foundation
# herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
# der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
# 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 $
#
AUTOMAKE_OPTIONS = ../portab/ansi2knr
INCLUDES = -I$(srcdir)/../portab
EXTRA_DIST = ngircd-test.conf connect-test.e channel-test.e mode-test.e
clean-local:
rm -f *.log *-test
maintainer-clean-local:
rm -f Makefile Makefile.in
check_SCRIPTS = tests.sh
connect-test: tests.sh
ln -s tests.sh connect-test
channel-test: tests.sh
ln -s tests.sh channel-test
mode-test: tests.sh
ln -s tests.sh mode-test
TESTS = start-server.sh \
connect-test \
channel-test \
mode-test \
stop-server.sh
# -eof-

View File

@ -0,0 +1,38 @@
# $Id: channel-test.e,v 1.1 2002/09/09 10:16:24 alex Exp $
spawn telnet localhost 6789
expect {
timeout { exit 1 }
"Connected"
}
send "nick nick\r"
send "user user . . :User\r"
expect {
timeout { exit 1 }
"376"
}
send "join #channel\r"
expect {
timeout { exit 1 }
":nick!~user@* JOIN :#channel"
}
expect {
timeout { exit 1 }
"366"
}
send "part #channel\r"
expect {
timeout { exit 1 }
":nick!~user@* PART #channel :nick"
}
send "quit\r"
expect {
timeout { exit 1 }
"Connection closed"
}
# -eof-

View File

@ -0,0 +1,21 @@
# $Id: connect-test.e,v 1.1 2002/09/09 10:16:24 alex Exp $
spawn telnet localhost 6789
expect {
timeout { exit 1 }
"Connected"
}
send "oper\r"
expect {
timeout { exit 1 }
"451"
}
send "quit\r"
expect {
timeout { exit 1 }
"Connection closed"
}
# -eof-

View File

View File

@ -0,0 +1,9 @@
# $Id: ngircd-test.conf,v 1.1 2002/09/09 10:16:24 alex Exp $
[Global]
Name = ngircd.test.server
Info = ngIRCd Test-Server
Ports = 6789
MotdFile = ngircd-test.motd
# -eof-

15
src/testsuite/start-server.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: start-server.sh,v 1.1 2002/09/09 10:16:24 alex Exp $
echo " starting server ..."
echo "This is an ngIRCd Test Server" > ngircd-test.motd
../ngircd/ngircd -np -f ngircd-test.conf > ngircd-test.log 2>&1 &
sleep 1
pid=`ps a | grep ngircd-test | head -n 1 | cut -d ' ' -f 1`
kill -0 $pid > /dev/null 2>&1
# -eof-

10
src/testsuite/stop-server.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: stop-server.sh,v 1.1 2002/09/09 10:16:24 alex Exp $
echo " stopping server ..."
pid=`ps a | grep ngircd-test | head -n 1 | cut -d ' ' -f 1`
kill $pid > /dev/null 2>&1
# -eof-

16
src/testsuite/tests.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# ngIRCd Test Suite
# $Id: tests.sh,v 1.1 2002/09/09 10:16:24 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
fi
echo " doing ${test} ..."
expect ${test}.e > ${test}.log
# -eof-