Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy

This commit is contained in:
eehouse@eehouse.org 2010-09-23 05:34:43 -07:00 committed by Andy2
commit acb52d11dc
2 changed files with 14 additions and 7 deletions

View file

@ -3,6 +3,10 @@
NGAMES=${NGAMES:-1} NGAMES=${NGAMES:-1}
NROOMS=${NROOMS:-1} NROOMS=${NROOMS:-1}
TIMEOUT=${TIMEOUT:-600} TIMEOUT=${TIMEOUT:-600}
HOST=${HOST:-localhost}
PORT=${PORT:-10997}
NAMES=(Brynn Ariela Kati Eric)
LOGDIR=$(basename $0)_logs LOGDIR=$(basename $0)_logs
mv $LOGDIR /tmp/$LOGDIR_$$ mv $LOGDIR /tmp/$LOGDIR_$$
@ -17,7 +21,7 @@ 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 TIMEOUT; do for VAR in NGAMES NROOMS USE_GTK TIMEOUT HOST PORT; do
echo "$VAR:" $(eval "echo \$${VAR}") 1>&2 echo "$VAR:" $(eval "echo \$${VAR}") 1>&2
done done
exit 0 exit 0
@ -41,8 +45,9 @@ do_device() {
STOPTIME=$(($(date "+%s") + TIMEOUT)) 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 ${NAMES[$DEV]} $OTHERS \
-d dict.xwd -f $FILE -z 1:3 $PLAT_PARMS >/dev/null 2>>$LOG & -d dict.xwd -p $PORT -a $HOST -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
@ -59,8 +64,8 @@ do_device() {
echo -n "timeout exceeded for device $DEV in game $GAME ($LOG)" echo -n "timeout exceeded for device $DEV in game $GAME ($LOG)"
date date
break break
elif ! pidof xwrelay > /dev/null; then elif [ ! -d $LOGDIR ]; then
break break;
fi fi
done done
} }

View file

@ -5,6 +5,8 @@ COOKIE=${COOKIE:-foo}
NGAMES=${NGAMES:-1} NGAMES=${NGAMES:-1}
NPLAYERS=${NPLAYERS:-2} NPLAYERS=${NPLAYERS:-2}
USE_GTK=${USE_GTK:-FALSE} USE_GTK=${USE_GTK:-FALSE}
HOST=${HOST:-localhost}
PORT=${PORT:-10997}
[ $USE_GTK = FALSE ] && CURSES_PARM="-u -0" [ $USE_GTK = FALSE ] && CURSES_PARM="-u -0"
@ -14,7 +16,7 @@ mkdir -p $LOGDIR
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 COOKIE DICT NGAMES NPLAYERS USE_GTK; do for VAR in COOKIE DICT NGAMES NPLAYERS HOST PORT USE_GTK; do
echo "$VAR:" $(eval "echo \$${VAR}") 1>&2 echo "$VAR:" $(eval "echo \$${VAR}") 1>&2
done done
exit 0 exit 0
@ -35,7 +37,7 @@ for II in $(seq $NGAMES); do
done done
for JJ in $(seq $NPLAYERS); do for JJ in $(seq $NPLAYERS); do
./obj_linux_memdbg/xwords $CURSES_PARM -d $DICT -r Eric $REMOTES \ ./obj_linux_memdbg/xwords $CURSES_PARM -d $DICT -r Eric $REMOTES \
-C $COOKIE -q 2 2>${LOGDIR}/log_${II}_${JJ}.txt >/dev/null & -a $HOST -p $PORT -C $COOKIE -q 2 2>${LOGDIR}/log_${II}_${JJ}.txt >/dev/null &
done done
done done