- Test-Suite fuer den ngIRCd begonnen.
authorAlexander Barton <alex@barton.de>
Mon, 9 Sep 2002 10:16:24 +0000 (10:16 +0000)
committerAlexander Barton <alex@barton.de>
Mon, 9 Sep 2002 10:16:24 +0000 (10:16 +0000)
src/testsuite/Makefile.am [new file with mode: 0644]
src/testsuite/channel-test.e [new file with mode: 0644]
src/testsuite/connect-test.e [new file with mode: 0644]
src/testsuite/mode-test.e [new file with mode: 0644]
src/testsuite/ngircd-test.conf [new file with mode: 0644]
src/testsuite/start-server.sh [new file with mode: 0755]
src/testsuite/stop-server.sh [new file with mode: 0755]
src/testsuite/tests.sh [new file with mode: 0755]

diff --git a/src/testsuite/Makefile.am b/src/testsuite/Makefile.am
new file mode 100644 (file)
index 0000000..8043c71
--- /dev/null
@@ -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 (file)
index 0000000..ce14613
--- /dev/null
@@ -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 (file)
index 0000000..49ce70c
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/src/testsuite/ngircd-test.conf b/src/testsuite/ngircd-test.conf
new file mode 100644 (file)
index 0000000..3475d67
--- /dev/null
@@ -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 (executable)
index 0000000..11b8121
--- /dev/null
@@ -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 (executable)
index 0000000..30b5df9
--- /dev/null
@@ -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 (executable)
index 0000000..4678654
--- /dev/null
@@ -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-