X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftestsuite%2Fstress-server.sh;h=c9b31b8242b20c5bf009a7065ba9730c04962083;hb=c5bdd86f96906a5367568d5210be59d1d36677e5;hp=6a91d2ceecce22043abec9fabe285b00bc5d7b8f;hpb=02b8e5156286abf2193630f6952e0313129e2102;p=ngircd-alex.git diff --git a/src/testsuite/stress-server.sh b/src/testsuite/stress-server.sh index 6a91d2ce..c9b31b82 100755 --- a/src/testsuite/stress-server.sh +++ b/src/testsuite/stress-server.sh @@ -9,7 +9,7 @@ # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # -# $Id: stress-server.sh,v 1.9 2004/09/04 13:58:31 alex Exp $ +# $Id: stress-server.sh,v 1.14 2004/09/04 19:14:46 alex Exp $ # # detect source directory @@ -17,7 +17,7 @@ # parse command line [ "$1" -gt 0 ] 2> /dev/null && CLIENTS="$1" || CLIENTS=5 -[ "$2" -gt 0 ] 2> /dev/null && LOOPS="$2" || LOOPS=1 +[ "$2" -gt 0 ] 2> /dev/null && MAX="$2" || MAX=-1 # get our name name=`basename $0` @@ -36,9 +36,7 @@ if [ $? -ne 0 ]; then fi # hello world! :-) -[ $LOOPS -gt 1 ] \ - && echo " stressing server with $CLIENTS clients in $LOOPS loops (be patient!):" \ - || echo " stressing server with $CLIENTS clients (be patient!):" +echo " stressing server with $CLIENTS clients (be patient!):" # create scripts for expect(1) no=0 @@ -49,42 +47,30 @@ while [ ${no} -lt $CLIENTS ]; do no=`expr ${no} + 1` done -# main loop ... -loop=0 -while [ ${loop} -lt $LOOPS ]; do - no=0 - loop=`expr ${loop} + 1` - while [ ${no} -lt $CLIENTS ]; do - expect tests/${no}.e > logs/stress-${no}.log 2> /dev/null & - no=`expr ${no} + 1` - done - if [ $LOOPS -gt 1 ]; then - echo " loop $loop/$LOOPS: started $no clients." - echo -n " loop $loop/$LOOPS: waiting for clients to complete: " - else - echo " started $no clients." - echo -n " waiting for clients to complete: " - fi +no=0 +while [ ${no} -lt $CLIENTS ]; do + expect tests/${no}.e > logs/stress-${no}.log 2> /dev/null & + + no=`expr ${no} + 1` + echo " started client $no/$CLIENTS." - res=3 - touch logs/check-idle.log - while true; do - expect ${srcdir}/check-idle.e >> logs/check-idle.log; res=$? - echo "====================" >> logs/check-idle.log - [ $res -ne 99 ] && break + [ $MAX -gt 0 ] && $srcdir/wait-tests.sh $MAX +done - # there are still clients connected. Wait ... - sleep 1 - echo -n "." - done +echo -n " waiting for clients to complete: ." +touch logs/check-idle.log +while true; do + expect ${srcdir}/check-idle.e >> logs/check-idle.log; res=$? + echo "====================" >> logs/check-idle.log + [ $res -ne 99 ] && break - if [ $res -ne 0 ]; then - echo " ERROR!" - break - fi - echo " done." + # there are still clients connected. Wait ... + sleep 3 + echo -n "." done +[ $res -eq 0 ] && echo " ok." || echo " failure!" + exit $res # -eof-