about summary refs log tree commit diff
path: root/src/testsuite/start-server.sh
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2008-11-13 22:46:06 +0100
committerAlexander Barton <alex@barton.de>2008-11-13 22:46:06 +0100
commit7ad167f4c43948f19125123a27dbe68a93e863b8 (patch)
tree465e4285ba654eaecefe818c08586c3dbbdf1788 /src/testsuite/start-server.sh
parent920d0636ff5741cb191f895e97ad151186701816 (diff)
downloadngircd-7ad167f4c43948f19125123a27dbe68a93e863b8.tar.gz
ngircd-7ad167f4c43948f19125123a27dbe68a93e863b8.zip
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.
Diffstat (limited to 'src/testsuite/start-server.sh')
-rwxr-xr-xsrc/testsuite/start-server.sh24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/testsuite/start-server.sh b/src/testsuite/start-server.sh
index 8d6c6506..15fa3f06 100755
--- a/src/testsuite/start-server.sh
+++ b/src/testsuite/start-server.sh
@@ -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
+
+echo_n "      starting server ${id} ..."
 
-# remove old logfiles
-rm -rf logs *.log
+# 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!"