mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
add timeout after which all games are killed
This commit is contained in:
parent
c671f2ab05
commit
b6ce74be1c
1 changed files with 11 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
NGAMES=${NGAMES:-1}
|
NGAMES=${NGAMES:-1}
|
||||||
NROOMS=${NROOMS:-1}
|
NROOMS=${NROOMS:-1}
|
||||||
|
TIMEOUT=${TIMEOUT:-600}
|
||||||
|
|
||||||
LOGDIR=$(basename $0)_logs
|
LOGDIR=$(basename $0)_logs
|
||||||
mv $LOGDIR /tmp/$LOGDIR_$$
|
mv $LOGDIR /tmp/$LOGDIR_$$
|
||||||
|
@ -11,14 +12,12 @@ USE_GTK=${USE_GTK:-FALSE}
|
||||||
|
|
||||||
if [ $USE_GTK = FALSE ]; then
|
if [ $USE_GTK = FALSE ]; then
|
||||||
PLAT_PARMS="-u -0"
|
PLAT_PARMS="-u -0"
|
||||||
else
|
|
||||||
PLAT_PARMS="-z 1:10"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: [env=val *] $0" 1>&2
|
echo "usage: [env=val *] $0" 1>&2
|
||||||
echo " current env variables and their values: " 1>&2
|
echo " current env variables and their values: " 1>&2
|
||||||
for VAR in NGAMES NROOMS USE_GTK; do
|
for VAR in NGAMES NROOMS USE_GTK TIMEOUT; do
|
||||||
echo "$VAR:" $(eval "echo \$${VAR}") 1>&2
|
echo "$VAR:" $(eval "echo \$${VAR}") 1>&2
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -39,10 +38,11 @@ do_device() {
|
||||||
OTHERS="-N $OTHERS"
|
OTHERS="-N $OTHERS"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
STOPTIME=$(($(date "+%s") + TIMEOUT))
|
||||||
while :; do
|
while :; do
|
||||||
sleep $((RANDOM%5))
|
sleep $((RANDOM%5))
|
||||||
./obj_linux_memdbg/xwords -C $ROOM -r edd $OTHERS \
|
./obj_linux_memdbg/xwords -C $ROOM -r edd $OTHERS \
|
||||||
-d dict.xwd -f $FILE $PLAT_PARMS >/dev/null 2>>$LOG &
|
-d dict.xwd -f $FILE -z 1:3 $PLAT_PARMS >/dev/null 2>>$LOG &
|
||||||
PID=$!
|
PID=$!
|
||||||
sleep $((RANDOM%10+5))
|
sleep $((RANDOM%10+5))
|
||||||
while :; do
|
while :; do
|
||||||
|
@ -52,11 +52,16 @@ do_device() {
|
||||||
done
|
done
|
||||||
|
|
||||||
if grep -q 'all remaining tiles' $LOG; then
|
if grep -q 'all remaining tiles' $LOG; then
|
||||||
echo -n "device $DEV in game $GAME succeeded ..."
|
echo -n "device $DEV in game $GAME succeeded ($LOG)"
|
||||||
date
|
date
|
||||||
break
|
break
|
||||||
|
elif [ $(date "+%s") -ge $STOPTIME ]; then
|
||||||
|
echo -n "timeout exceeded for device $DEV in game $GAME ($LOG)"
|
||||||
|
date
|
||||||
|
break
|
||||||
|
elif ! pidof xwrelay > /dev/null; then
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
pidof xwrelay > /dev/null || break
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue