diff options
| author | Mistivia <i@mistivia.com> | 2025-10-23 23:44:03 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-10-23 23:44:07 +0800 |
| commit | c8aeef18cb46a617b6397b9822263895e97e9048 (patch) | |
| tree | ebe127e7c194039f315b74a5998b05a271c57b9d /ngircd/src/testsuite/start-server.sh | |
add ircd
Diffstat (limited to 'ngircd/src/testsuite/start-server.sh')
| -rwxr-xr-x | ngircd/src/testsuite/start-server.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ngircd/src/testsuite/start-server.sh b/ngircd/src/testsuite/start-server.sh new file mode 100755 index 0000000..bc6eb7e --- /dev/null +++ b/ngircd/src/testsuite/start-server.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# ngIRCd Test Suite + +[ -z "$srcdir" ] && srcdir=`dirname "$0"` +set -u + +# read in functions +. "${srcdir}/functions.inc" + +if [ -n "$1" ]; then + id="$1"; shift +else + id="1" +fi + +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. +./getpid.sh sh >/dev/null +if [ $? -ne 0 ]; then + echo " getpid.sh failed!" + exit 1 +fi + +# check if there is a test-server already running +./getpid.sh T-ngircd${id} >/dev/null 2>&1 +if [ $? -eq 0 ]; then + echo " failure: test-server ${id} already running!" + exit 1 +fi + +# generate MOTD for test-server +echo "This is an ngIRCd Test Server" >ngircd-test${id}.motd + +# glibc memory checking, see malloc(3) +MALLOC_CHECK_=3 +export MALLOC_CHECK_ + +# starting up test-server ... +./T-ngircd${id} -n -f "${srcdir}/ngircd-test${id}.conf" "$@" \ + >ngircd-test${id}.log 2>&1 & +sleep 1 + +# validate running test-server +r=1 +pid=`./getpid.sh T-ngircd${id}` +[ -n "$pid" ] && kill -0 $pid >/dev/null 2>&1; r=$? +[ $r -eq 0 ] && echo " ok." || echo " failure!" +exit $r |
