commit c4d78a346942afdaf6bd19f8cad88d6678eaa608 from: Alexander Barton date: Mon Sep 09 10:16:24 2002 UTC - Test-Suite fuer den ngIRCd begonnen. commit - dd4535b7f14bef69039efde600f5d2f4540351cd commit + c4d78a346942afdaf6bd19f8cad88d6678eaa608 blob - /dev/null blob + 8043c71d5fcc8b7e2f9b05d2a5c81bbea4917fbb (mode 644) --- /dev/null +++ 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- blob - /dev/null blob + ce14613c5f46bcce34a689544c68d9a8153f6cc4 (mode 644) --- /dev/null +++ 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- blob - /dev/null blob + 49ce70c12685d258aa5ede6c4c2d676eae920126 (mode 644) --- /dev/null +++ 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- blob - /dev/null blob + e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 (mode 644) blob - /dev/null blob + 3475d677404799e94f59c8ffd3c59da59b79595c (mode 644) --- /dev/null +++ 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- blob - /dev/null blob + 11b8121b4fa7e0c5ee23e23f69bd44136964063b (mode 755) --- /dev/null +++ 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- blob - /dev/null blob + 30b5df94363b289a16bcd10e6d13dc16928fa5da (mode 755) --- /dev/null +++ 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- blob - /dev/null blob + 4678654986c4784f5eb758734c5db068319b9475 (mode 755) --- /dev/null +++ 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-