diff --git a/src/testsuite/Makefile.am b/src/testsuite/Makefile.am new file mode 100644 index 00000000..8043c71d --- /dev/null +++ b/src/testsuite/Makefile.am @@ -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- diff --git a/src/testsuite/channel-test.e b/src/testsuite/channel-test.e new file mode 100644 index 00000000..ce14613c --- /dev/null +++ b/src/testsuite/channel-test.e @@ -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- diff --git a/src/testsuite/connect-test.e b/src/testsuite/connect-test.e new file mode 100644 index 00000000..49ce70c1 --- /dev/null +++ b/src/testsuite/connect-test.e @@ -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- diff --git a/src/testsuite/mode-test.e b/src/testsuite/mode-test.e new file mode 100644 index 00000000..e69de29b diff --git a/src/testsuite/ngircd-test.conf b/src/testsuite/ngircd-test.conf new file mode 100644 index 00000000..3475d677 --- /dev/null +++ b/src/testsuite/ngircd-test.conf @@ -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- diff --git a/src/testsuite/start-server.sh b/src/testsuite/start-server.sh new file mode 100755 index 00000000..11b8121b --- /dev/null +++ b/src/testsuite/start-server.sh @@ -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- diff --git a/src/testsuite/stop-server.sh b/src/testsuite/stop-server.sh new file mode 100755 index 00000000..30b5df94 --- /dev/null +++ b/src/testsuite/stop-server.sh @@ -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- diff --git a/src/testsuite/tests.sh b/src/testsuite/tests.sh new file mode 100755 index 00000000..46786549 --- /dev/null +++ b/src/testsuite/tests.sh @@ -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-