]> arthur.barton.de Git - ngircd-alex.git/commitdiff
- EXTRA_DIST ergaenzt, clean-Target erweitert.
authorAlexander Barton <alex@barton.de>
Mon, 9 Sep 2002 22:56:07 +0000 (22:56 +0000)
committerAlexander Barton <alex@barton.de>
Mon, 9 Sep 2002 22:56:07 +0000 (22:56 +0000)
- neues Script "stress-server.sh" integriert.

src/testsuite/Makefile.am
src/testsuite/check-idle.e [new file with mode: 0644]
src/testsuite/start-server.sh
src/testsuite/stress-A.e [new file with mode: 0644]
src/testsuite/stress-B.e [new file with mode: 0644]
src/testsuite/stress-server.sh [new file with mode: 0755]
src/testsuite/tests.sh

index 8043c71d5fcc8b7e2f9b05d2a5c81bbea4917fbb..85c855464f88b36ebe3129f11d455ba393a8e424 100644 (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-
diff --git a/src/testsuite/check-idle.e b/src/testsuite/check-idle.e
new file mode 100644 (file)
index 0000000..08d79ca
--- /dev/null
@@ -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-
index 11b8121b4fa7e0c5ee23e23f69bd44136964063b..51de410ec4f2aa49e5bcd5ddda13f007153089c8 100755 (executable)
@@ -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-
diff --git a/src/testsuite/stress-A.e b/src/testsuite/stress-A.e
new file mode 100644 (file)
index 0000000..4127dcc
--- /dev/null
@@ -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-
diff --git a/src/testsuite/stress-B.e b/src/testsuite/stress-B.e
new file mode 100644 (file)
index 0000000..117e152
--- /dev/null
@@ -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-
diff --git a/src/testsuite/stress-server.sh b/src/testsuite/stress-server.sh
new file mode 100755 (executable)
index 0000000..f978f4b
--- /dev/null
@@ -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-
index 4678654986c4784f5eb758734c5db068319b9475..e2ddd930b78a2ec5a857dd45040b87104cd782f5 100755 (executable)
@@ -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-