about summary refs log tree commit diff
path: root/src/testsuite/start-server.sh
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2024-03-31 19:53:16 +0200
committerAlexander Barton <alex@barton.de>2024-04-05 23:16:07 +0200
commit7e78c293a97239f895b862836c65c4b755abdc52 (patch)
tree3a783304baa2588d9c3779a79a74d41356d3f308 /src/testsuite/start-server.sh
parent8d6f2c2820567a350c57dd15cee06e13535471c2 (diff)
downloadngircd-7e78c293a97239f895b862836c65c4b755abdc52.tar.gz
ngircd-7e78c293a97239f895b862836c65c4b755abdc52.zip
Test suite: clean up scripts
- Reformat code.
- Cleanup some glitches, streamline scripts ...
- Enable "set -u": Error on unset variables.
- Detect "$srcdir" in prep-server3 script, too.
Diffstat (limited to 'src/testsuite/start-server.sh')
-rwxr-xr-xsrc/testsuite/start-server.sh25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/testsuite/start-server.sh b/src/testsuite/start-server.sh
index 3d19ffb5..599bf3ad 100755
--- a/src/testsuite/start-server.sh
+++ b/src/testsuite/start-server.sh
@@ -1,10 +1,11 @@
 #!/bin/sh
 # ngIRCd Test Suite
 
-[ -z "$srcdir" ] && srcdir=`dirname $0`
+[ -z "$srcdir" ] && srcdir=`dirname "$0"`
+set -u
 
 # read in functions
-. ${srcdir}/functions.inc
+. "${srcdir}/functions.inc"
 
 if [ -n "$1" ]; then
 	id="$1"; shift
@@ -19,36 +20,34 @@ echo_n "starting server ${id} ..."
 
 # 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 2>&1
+./getpid.sh sh >/dev/null 2>&1
 if [ $? -ne 0 ]; then
-  echo " getpid.sh failed!"
-  exit 1
+	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
+	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
+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 $* \
+./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=$?
-
+[ -n "$pid" ] && kill -0 $pid >/dev/null 2>&1; r=$?
 [ $r -eq 0 ] && echo " ok." || echo " failure!"
 exit $r
-
-# -eof-