]> arthur.barton.de Git - ngircd.git/blobdiff - src/testsuite/stop-server.sh
Updated "test suite". From HEAD.
[ngircd.git] / src / testsuite / stop-server.sh
index 0064baf2bf3662b0903f8356452347d327f009c4..66ecdf044c50f6079f8528852e1bf2b3a84f0f0c 100755 (executable)
@@ -1,15 +1,29 @@
 #!/bin/sh
 # ngIRCd Test Suite
-# $Id: stop-server.sh,v 1.6 2002/09/20 13:57:01 alex Exp $
+# $Id: stop-server.sh,v 1.10.2.1 2004/09/04 20:49:36 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
+echo -n "      stopping server ..."
 
-ps $PS_FLAGS > procs.tmp
-pid=`cat procs.tmp | grep ngircd-TEST | awk "{ print \\\$$PS_PIDCOL }"`
-[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
+# 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 -eq 0 ]; then
+    echo " ok".
+    exit 0
+  fi
+  sleep 1
+done
+echo " failure: server still running!?"
+exit 1
 
 # -eof-