]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/testsuite/stop-server.sh
Don't use a POSIX thread for the Howl "run loop".
[ngircd-alex.git] / src / testsuite / stop-server.sh
index ee9d9dccfd9c3f319226f9153acb6146aa051b47..256d512eeb17f7ad1787d71e6e22601561290399 100755 (executable)
@@ -1,15 +1,32 @@
 #!/bin/sh
 # ngIRCd Test Suite
-# $Id: stop-server.sh,v 1.5 2002/09/18 20:58:56 alex Exp $
+# $Id: stop-server.sh,v 1.13 2004/09/06 22:04:06 alex Exp $
 
-echo "      stopping server ..."
+[ -z "$srcdir" ] && srcdir=`dirname $0`
 
-PS_FLAGS=-f; PS_PIDCOL=2
-ps $PS_FLAGS > /dev/null 2>&1
-if [ $? -ne 0 ]; then PS_FLAGS=a; PS_PIDCOL=1; fi
+# read in functions
+. ${srcdir}/functions.inc
 
-ps $PS_FLAGS > procs.tmp
-pid=`cat procs.tmp | grep ngircd-TEST | awk "{ print \\\$$PS_PIDCOL }"`
-kill $pid > /dev/null 2>&1
+echo_n "      stopping server ..."
+
+# stop test-server ...
+pid=`./getpid.sh T-ngircd`
+if [ -z "$pid" ]; then
+  echo " failure: no running server found!?"
+  exit 1
+fi
+kill $pid > /dev/null 2>&1 || exit 1
+
+# waiting ...
+for i in 1 2 3 4 5; do
+  kill -0 $pid > /dev/null 2>&1; r=$?
+  if [ $r -ne 0 ]; then
+    echo " ok".
+    exit 0
+  fi
+  sleep 1
+done
+echo " failure: server still running!?"
+exit 1
 
 # -eof-