Test suite: start two servers and test server-server links
I changed the test suite to start two test servers (on port 6789 and 6790), so server-server links can be tested as well for which I included the new test script "server-link-test.e". In addition the documentation of the test suite (src/testsuite/README) has been updated and is more complete now.
This commit is contained in:
parent
920d0636ff
commit
7ad167f4c4
|
@ -1,4 +1,5 @@
|
|||
T-ngircd
|
||||
T-ngircd1
|
||||
T-ngircd2
|
||||
channel-test
|
||||
connect-test
|
||||
invite-test
|
||||
|
@ -8,8 +9,11 @@ message-test
|
|||
misc-test
|
||||
mode-test
|
||||
opless-channel-test
|
||||
server-link-test
|
||||
who-test
|
||||
ngircd-test.log
|
||||
ngircd-test.motd
|
||||
ngircd-test1.log
|
||||
ngircd-test2.log
|
||||
ngircd-test1.motd
|
||||
ngircd-test2.motd
|
||||
logs
|
||||
tests
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# ngIRCd -- The Next Generation IRC Daemon
|
||||
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||
# Copyright (c)2001-2008 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
|
||||
|
@ -9,8 +9,6 @@
|
|||
# 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.18 2008/02/17 13:26:42 alex Exp $
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = ../portab/ansi2knr
|
||||
|
||||
|
@ -22,14 +20,16 @@ EXTRA_DIST = \
|
|||
test-loop.sh wait-tests.sh \
|
||||
channel-test.e connect-test.e check-idle.e invite-test.e \
|
||||
join-test.e kick-test.e message-test.e misc-test.e mode-test.e \
|
||||
opless-channel-test.e who-test.e stress-A.e stress-B.e \
|
||||
ngircd-test.conf
|
||||
opless-channel-test.e server-link-test.e who-test.e \
|
||||
stress-A.e stress-B.e \
|
||||
start-server1 stop-server1 ngircd-test1.conf \
|
||||
start-server2 stop-server2 ngircd-test2.conf
|
||||
|
||||
all:
|
||||
|
||||
clean-local:
|
||||
rm -rf logs tests *-test ngircd-test.log ngircd-test.motd \
|
||||
T-ngircd procs.tmp
|
||||
rm -rf logs tests *-test ngircd-test*.log procs.tmp \
|
||||
T-ngircd1 ngircd-test1.motd T-ngircd2 ngircd-test2.motd
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile Makefile.in
|
||||
|
@ -37,7 +37,8 @@ maintainer-clean-local:
|
|||
check_SCRIPTS = ngircd-TEST-Binary tests.sh
|
||||
|
||||
ngircd-TEST-Binary:
|
||||
cp ../ngircd/ngircd T-ngircd
|
||||
cp ../ngircd/ngircd T-ngircd1
|
||||
cp ../ngircd/ngircd T-ngircd2
|
||||
[ -f getpid.sh ] || ln -s $(srcdir)/getpid.sh .
|
||||
|
||||
connect-test: tests.sh
|
||||
|
@ -76,12 +77,17 @@ opless-channel-test: tests.sh
|
|||
rm -f opless-channel-test
|
||||
ln -s $(srcdir)/tests.sh opless-channel-test
|
||||
|
||||
server-link-test: tests.sh
|
||||
rm -f server-link-test
|
||||
ln -s $(srcdir)/tests.sh server-link-test
|
||||
|
||||
who-test: tests.sh
|
||||
rm -f who-test
|
||||
ln -s $(srcdir)/tests.sh who-test
|
||||
|
||||
TESTS = start-server.sh \
|
||||
TESTS = start-server1 \
|
||||
connect-test \
|
||||
start-server2 \
|
||||
channel-test \
|
||||
invite-test \
|
||||
join-test \
|
||||
|
@ -91,7 +97,9 @@ TESTS = start-server.sh \
|
|||
mode-test \
|
||||
opless-channel-test \
|
||||
who-test \
|
||||
server-link-test \
|
||||
stop-server2 \
|
||||
stress-server.sh \
|
||||
stop-server.sh
|
||||
stop-server1
|
||||
|
||||
# -eof-
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
ngIRCd - Next Generation IRC Server
|
||||
|
||||
(c)2001-2004 by Alexander Barton,
|
||||
(c)2001-2008 Alexander Barton,
|
||||
alex@barton.de, http://www.barton.de/
|
||||
|
||||
ngIRCd is free software and published under the
|
||||
|
@ -17,14 +17,20 @@ The purpose of the "test suite" contained in this directory is to detect
|
|||
bugs and incompatibilities in ngIRCd introduced during coding and after
|
||||
building ngIRCd on a specific platform.
|
||||
|
||||
To run the "standard" tests call "make check". It will build ngIRCd (if
|
||||
required) and run some tests on it. These tests should be portable and run
|
||||
on all supported platforms without errors.
|
||||
To run the "standard" tests call "make check" (which runs "make check" in
|
||||
all the source directories, testing the "portab" library as well for example)
|
||||
or "make testsuite" (which only runs the tests in this directory). Both will
|
||||
build ngIRCd (if required) and run some tests on it. These tests should be
|
||||
portable and run on all supported platforms without errors.
|
||||
|
||||
Please note: most tests of this suite depend on the external tools expect(1)
|
||||
NOTE #1: most tests of this suite depend on the external tools expect(1)
|
||||
and telnet(1), so make sure you have them installed. If not, the tests will
|
||||
not fail but simply be skipped.
|
||||
|
||||
NOTE #2: the two test servers started by this test suite are configured to
|
||||
run on port 6789 and 6790; so it will fail if one or both of these ports
|
||||
are already used by some other daemons!
|
||||
|
||||
|
||||
II. Shell Scripts
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
@ -35,26 +41,43 @@ getpid.sh <name>
|
|||
the given name in a portable manner. The result is echoed on the
|
||||
console. It is a helper script for some other scripts of this suite.
|
||||
|
||||
start-server.sh
|
||||
start-server.sh [<id>]
|
||||
|
||||
start-server.sh starts up the test binary, "T-ngircd". It makes sure
|
||||
that getpid.sh is available and working, and that no other instance
|
||||
of the test binary is already running.
|
||||
start-server.sh starts up the test binary, "T-ngircd<id>" (the default
|
||||
for <id> is 1) with configuration file "ngircd-test<id>.conf" and the
|
||||
console output redirected to "ngircd-test<id>.log".
|
||||
The script first makes sure that getpid.sh is available and working,
|
||||
and that no other instance of the test binary is already running.
|
||||
The exit code is 0 if the test binary could be started.
|
||||
|
||||
stop-server.sh
|
||||
stop-server.sha [<id>]
|
||||
|
||||
This script uses getpid.sh to detect a running test binary "T-ngircd"
|
||||
and then shuts it down using the TERM signal.
|
||||
This script uses getpid.sh to detect a running test binary
|
||||
"T-ngircd<id>" and then shuts it down using the TERM signal.
|
||||
The exit code is 0 if the test binary could be stopped.
|
||||
|
||||
stress-server.sh
|
||||
stress-server.sh [<clientCount> [<maxConcurrent>]]
|
||||
|
||||
...
|
||||
stress-server.sh starts <clientCount> clients that "stress" the
|
||||
running test server (id 1); but no more than <maxConcurrent> clients
|
||||
are started at the same moment.
|
||||
|
||||
tests.sh
|
||||
|
||||
...
|
||||
Most of the tests scripts are symlinked to tests.sh, which in turn
|
||||
uses expect(1) to run the respective script <name>.e and checks
|
||||
its exit code.
|
||||
|
||||
test-loop.sh [<loops> [<wait>]]
|
||||
|
||||
This script runs all the tests <loops> times (default: 5) and pauses
|
||||
<wait> seconds (default: 5) betweed runs.
|
||||
It isn't used by "make check" or "make testsuite".
|
||||
|
||||
wait-tests.sh [<max>]
|
||||
|
||||
stress-server.sh uses this script to ensure that no more than <max>
|
||||
clients are connected to the test server (id 1).
|
||||
|
||||
|
||||
III. Scripts for expect(1)
|
||||
|
@ -63,10 +86,14 @@ III. Scripts for expect(1)
|
|||
channel-test.e
|
||||
check-idle.e
|
||||
connect-test.e
|
||||
invite-test.e
|
||||
join-test.e
|
||||
kick-test.e
|
||||
message-test.e
|
||||
misc-test.e
|
||||
mode-test.e
|
||||
opless-channel-test.e
|
||||
server-link-test.e
|
||||
stress-A.e
|
||||
stress-B.e
|
||||
|
||||
|
||||
--
|
||||
$Id: README,v 1.1 2004/09/04 13:58:31 alex Exp $
|
||||
who-test.e
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# $Id: ngircd-test.conf,v 1.6 2008/02/17 00:00:13 fw Exp $
|
||||
# ngIRCd test suite
|
||||
# configuration file for test server #2
|
||||
|
||||
[Global]
|
||||
Name = ngircd.test.server
|
||||
Info = ngIRCd Test-Server
|
||||
Info = ngIRCd Test-Server 1
|
||||
Ports = 6789
|
||||
MotdFile = ngircd-test.motd
|
||||
MotdFile = ngircd-test1.motd
|
||||
AdminEMail = admin@irc.server
|
||||
MaxConnectionsIP = 0
|
||||
OperCanUseMode = yes
|
||||
|
@ -14,22 +15,27 @@
|
|||
Name = TestOp
|
||||
Password = 123
|
||||
|
||||
[CHANNEL]
|
||||
[Server]
|
||||
Name = ngircd.test.server2
|
||||
MyPassword = pwd1
|
||||
PeerPassword = pwd2
|
||||
|
||||
[Channel]
|
||||
Name = #InviteChannel
|
||||
Modes = i
|
||||
|
||||
[CHANNEL]
|
||||
[Channel]
|
||||
Name = #FullKeyed
|
||||
Modes = lk
|
||||
MaxUsers = 0
|
||||
Key = Secret
|
||||
|
||||
[CHANNEL]
|
||||
[Channel]
|
||||
Name = #TopicChannel
|
||||
Modes = t
|
||||
Topic = the topic
|
||||
|
||||
[CHANNEL]
|
||||
[Channel]
|
||||
Name = #SecretChannel
|
||||
Modes = s
|
||||
Topic = A secret Channel
|
|
@ -0,0 +1,25 @@
|
|||
# ngIRCd test suite
|
||||
# configuration file for test server #2
|
||||
|
||||
[Global]
|
||||
Name = ngircd.test.server2
|
||||
Info = ngIRCd Test-Server 2
|
||||
Ports = 6790
|
||||
MotdFile = ngircd-test2.motd
|
||||
AdminEMail = admin@irc.server2
|
||||
MaxConnectionsIP = 0
|
||||
OperCanUseMode = yes
|
||||
MaxJoins = 4
|
||||
|
||||
[Operator]
|
||||
Name = TestOp
|
||||
Password = 123
|
||||
|
||||
[Server]
|
||||
Name = ngircd.test.server
|
||||
Host = localhost
|
||||
Port = 6789
|
||||
MyPassword = pwd2
|
||||
PeerPassword = pwd1
|
||||
|
||||
# -eof-
|
|
@ -0,0 +1,52 @@
|
|||
# ngIRCd test suite
|
||||
# server-server link test
|
||||
|
||||
spawn telnet localhost 6790
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
"Connected"
|
||||
}
|
||||
|
||||
send "nick nick\r"
|
||||
send "user user . . :User\r"
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
"376"
|
||||
}
|
||||
|
||||
send "version ngircd.test.server2\r"
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
":ngircd.test.server2 351"
|
||||
}
|
||||
send "version ngircd.test.server\r"
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
":ngircd.test.server 351"
|
||||
}
|
||||
|
||||
send "whois ngircd.test.server nick\r"
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
":ngircd.test.server 318"
|
||||
}
|
||||
|
||||
send "admin ngircd.test.server\r"
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
":ngircd.test.server 259 nick :admin@irc.server"
|
||||
}
|
||||
|
||||
send "links\r"
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
"364 nick ngircd.test.server ngircd.test.server2 :1"
|
||||
}
|
||||
|
||||
send "quit\r"
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
"ERROR"
|
||||
}
|
||||
|
||||
# -eof-
|
|
@ -1,16 +1,21 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
# $Id: start-server.sh,v 1.14 2004/09/06 22:04:06 alex Exp $
|
||||
|
||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||
|
||||
# read in functions
|
||||
. ${srcdir}/functions.inc
|
||||
|
||||
echo_n " starting server ..."
|
||||
if [ -n "$1" ]; then
|
||||
id="$1"; shift
|
||||
else
|
||||
id="1"
|
||||
fi
|
||||
|
||||
# remove old logfiles
|
||||
rm -rf logs *.log
|
||||
echo_n " starting server ${id} ..."
|
||||
|
||||
# remove old logfiles, if this is the first server (ID 1)
|
||||
[ "$id" = "1" ] && rm -rf logs *.log
|
||||
|
||||
# check weather getpid.sh returns valid PIDs. If not, don't start up the
|
||||
# test-server, because we won't be able to kill it at the end of the test.
|
||||
|
@ -21,21 +26,22 @@ if [ $? -ne 0 ]; then
|
|||
fi
|
||||
|
||||
# check if there is a test-server already running
|
||||
./getpid.sh T-ngircd > /dev/null 2>&1
|
||||
./getpid.sh T-ngircd${id} >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo " failure: test-server already running!"
|
||||
echo " failure: test-server ${id} already running!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# generate MOTD for test-server
|
||||
echo "This is an ngIRCd Test Server" > ngircd-test.motd
|
||||
echo "This is an ngIRCd Test Server" > ngircd-test${id}.motd
|
||||
|
||||
# starting up test-server ...
|
||||
./T-ngircd -np -f ${srcdir}/ngircd-test.conf $* > ngircd-test.log 2>&1 &
|
||||
./T-ngircd${id} -n -f ${srcdir}/ngircd-test${id}.conf $* \
|
||||
>ngircd-test${id}.log 2>&1 &
|
||||
sleep 1
|
||||
|
||||
# validate running test-server
|
||||
pid=`./getpid.sh T-ngircd`
|
||||
pid=`./getpid.sh T-ngircd${id}`
|
||||
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1; r=$?
|
||||
|
||||
[ $r -eq 0 ] && echo " ok." || echo " failure!"
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
|
||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||
${srcdir}/start-server.sh 1
|
||||
|
||||
# -eof-
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
|
||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||
${srcdir}/start-server.sh 2
|
||||
|
||||
# -eof-
|
|
@ -1,16 +1,21 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
# $Id: stop-server.sh,v 1.13 2004/09/06 22:04:06 alex Exp $
|
||||
|
||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||
|
||||
# read in functions
|
||||
. ${srcdir}/functions.inc
|
||||
|
||||
echo_n " stopping server ..."
|
||||
if [ -n "$1" ]; then
|
||||
id="$1"; shift
|
||||
else
|
||||
id="1"
|
||||
fi
|
||||
|
||||
echo_n " stopping server ${id} ..."
|
||||
|
||||
# stop test-server ...
|
||||
pid=`./getpid.sh T-ngircd`
|
||||
pid=`./getpid.sh T-ngircd${id}`
|
||||
if [ -z "$pid" ]; then
|
||||
echo " failure: no running server found!?"
|
||||
exit 1
|
||||
|
@ -26,7 +31,7 @@ for i in 1 2 3 4 5; do
|
|||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo " failure: server still running!?"
|
||||
echo " failure: server ${id} still running!?"
|
||||
exit 1
|
||||
|
||||
# -eof-
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
|
||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||
${srcdir}/stop-server.sh 1
|
||||
|
||||
# -eof-
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
# ngIRCd Test Suite
|
||||
|
||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||
${srcdir}/stop-server.sh 2
|
||||
|
||||
# -eof-
|
Loading…
Reference in New Issue