about summary refs log tree commit diff
path: root/src/testsuite/wait-tests.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/wait-tests.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/wait-tests.sh')
-rwxr-xr-xsrc/testsuite/wait-tests.sh33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/testsuite/wait-tests.sh b/src/testsuite/wait-tests.sh
index fb3be185..b6fa08f5 100755
--- a/src/testsuite/wait-tests.sh
+++ b/src/testsuite/wait-tests.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # ngIRCd Test Suite
-# Copyright (c)2002-2004 by Alexander Barton (alex@barton.de)
+# Copyright (c)2001-2024 Alexander Barton (alex@barton.de) and Contributors.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -9,39 +9,36 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: wait-tests.sh,v 1.5 2005/08/12 21:34:19 alex Exp $
-#
 
-[ "$1" -gt 0 ] 2> /dev/null && MAX="$1" || MAX=5
+[ "$1" -gt 0 ] 2>/dev/null && MAX="$1" || MAX=5
 
 # detect source directory
-[ -z "$srcdir" ] && srcdir=`dirname $0`
+[ -z "$srcdir" ] && srcdir=`dirname "$0"`
+set -u
 
 PS_FLAGS="-f"
 ps $PS_FLAGS >/dev/null 2>&1
 [ $? -ne 0 ] && PS_FLAGS="a"
 
 # read in functions
-. ${srcdir}/functions.inc
+. "${srcdir}/functions.inc"
 
 msg=0
 while true; do
-  count=`ps $PS_FLAGS | grep "expect " | wc -l`
-  count=`expr $count - 1`
+	count=`ps $PS_FLAGS | grep "expect " | wc -l`
+	count=`expr $count - 1`
 
-  [ $count -le $MAX ] && break
+	[ $count -le $MAX ] && break
 
-  if [ $msg -lt 1 ]; then
-    echo_n "      waiting for processes to settle: "
-    msg=1
-  fi
+	if [ $msg -lt 1 ]; then
+		echo_n "      waiting for processes to settle: "
+		msg=1
+	fi
 
-  # there are still clients connected. Wait ...
-  echo_n "$count>$MAX "
-  sleep 1
+	# there are still clients connected. Wait ...
+	echo_n "$count>$MAX "
+	sleep 1
 done
 
 [ $msg -gt 0 ] && echo "done: $count"
 exit 0
-
-# -eof-