mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
account for possibility client apps won't exit on TERM
This commit is contained in:
parent
84a26c2c1a
commit
d199ec5168
1 changed files with 21 additions and 9 deletions
|
@ -4,6 +4,7 @@ NGAMES=${NGAMES:-1}
|
||||||
NROOMS=${NROOMS:-1}
|
NROOMS=${NROOMS:-1}
|
||||||
|
|
||||||
LOGDIR=$(basename $0)_logs
|
LOGDIR=$(basename $0)_logs
|
||||||
|
mv $LOGDIR /tmp/$LOGDIR_$$
|
||||||
mkdir -p $LOGDIR
|
mkdir -p $LOGDIR
|
||||||
|
|
||||||
USE_GTK=${USE_GTK:-FALSE}
|
USE_GTK=${USE_GTK:-FALSE}
|
||||||
|
@ -27,7 +28,9 @@ do_device() {
|
||||||
GAME=$1
|
GAME=$1
|
||||||
DEV=$2
|
DEV=$2
|
||||||
NDEVS=$3
|
NDEVS=$3
|
||||||
LOG=$4
|
|
||||||
|
LOG=${LOGDIR}/${GAME}_${DEV}_LOG.txt
|
||||||
|
rm -f $LOG
|
||||||
ROOM=ROOM_$((GAME%NROOMS))
|
ROOM=ROOM_$((GAME%NROOMS))
|
||||||
|
|
||||||
FILE="GAME_${GAME}_${DEV}.xwg"
|
FILE="GAME_${GAME}_${DEV}.xwg"
|
||||||
|
@ -41,11 +44,16 @@ do_device() {
|
||||||
./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 $PLAT_PARMS >/dev/null 2>>$LOG &
|
||||||
PID=$!
|
PID=$!
|
||||||
sleep $((RANDOM%10+10))
|
sleep $((RANDOM%10+5))
|
||||||
kill $PID 2>/dev/null
|
while :; do
|
||||||
|
kill $PID 2>/dev/null
|
||||||
|
[ -d /proc/$PID ] || break
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
if [ $(grep -c 'all remaining tiles' $LOG) -eq $NDEVS ]; then
|
if grep -q 'all remaining tiles' $LOG; then
|
||||||
echo "game for $LOG succeeded"
|
echo -n "device $DEV in game $GAME succeeded ..."
|
||||||
|
date
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
pidof xwrelay > /dev/null || break
|
pidof xwrelay > /dev/null || break
|
||||||
|
@ -56,11 +64,8 @@ do_game() {
|
||||||
INDEX=$1
|
INDEX=$1
|
||||||
NDEVS=$(($RANDOM%3+2))
|
NDEVS=$(($RANDOM%3+2))
|
||||||
|
|
||||||
LOG="${LOGDIR}/LOG_${INDEX}.txt"
|
|
||||||
rm -f $LOG
|
|
||||||
|
|
||||||
for DEV in $(seq $NDEVS); do
|
for DEV in $(seq $NDEVS); do
|
||||||
do_device $INDEX $DEV $NDEVS $LOG &
|
do_device $INDEX $DEV $NDEVS &
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,3 +82,10 @@ for GAME in $(seq 1 $NGAMES); do
|
||||||
done
|
done
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
||||||
|
for LOG in $LOGDIR/*LOG.txt; do
|
||||||
|
echo -n "$LOG "
|
||||||
|
grep 'got_connect_cmd: connName' $LOG | \
|
||||||
|
sed 's,^.*connName: \"\(.*\)\"$,\1,' | \
|
||||||
|
sort -u
|
||||||
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue