copy improvements from trunk, then fix to deal with missing dict and

use new -o flag.
This commit is contained in:
eehouse 2010-03-28 16:09:27 +00:00
parent 6325c3dc63
commit 47f74ceef7

View file

@ -5,9 +5,14 @@ ROOM_ADD=""
NGAMES=10
PORT=10999
DBUG=0
HOW_LONG=1000
HOW_LONG=360
DICT=dict.xwd
RUN_NAME=$(basename $0)_$$
LOG_DIR=/tmp/${RUN_NAME}_LOG
mkdir -p ${LOG_DIR}
usage() {
[ -n "$1" ] && echo "$1" >&2
echo "usage: $0 \\" >&2
@ -27,24 +32,30 @@ do_one() {
EXE=$1
INDEX=$2
while :; do
while [ -d ${LOG_DIR} ]; do
ROOM="playme ${INDEX}$ROOM_ADD"
LOG_FILE="${LOG_DIR}/${ROOM}.log"
#COMMAND="$EXE -u -0 -C \"$ROOM\" -a $HOSTNAME -r Relay -d $DICT -p $PORT"
# it's a server if INDEX is odd
if [ 0 -eq $((INDEX%2)) ]; then
if [ 0 -ne $((INDEX%2)) ]; then
SERVER=" -s -N "
fi
#echo $COMMAND
$EXE -u -0 -C "$ROOM" -a $HOSTNAME -r Relay -d $DICT -p $PORT $SERVER >/dev/null 2>&1 &
$EXE -u -o -0 -C "$ROOM" -a $HOSTNAME -r Relay -d $DICT -p $PORT \
$SERVER >/dev/null 2>>${LOG_FILE} &
PID=$!
echo "launched $ROOM ($PID)"
echo "launched $ROOM (pid=$PID)"
END_TIME=$(($(date +%s) + $HOW_LONG))
while [ -d /proc/$PID ]; do
sleep 10
if [ $(date +%s) -ge $END_TIME ]; then
if [ ! -d ${LOG_DIR} ]; then
break
elif [ ! -d /proc/$PID ]; then
break
elif [ $(date +%s) -ge $END_TIME ]; then
echo "timing out $ROOM ($PID)"
break
fi
@ -55,8 +66,6 @@ do_one() {
done
}
while [ -n "$1" ]; do
case $1 in
--delay)
@ -79,6 +88,11 @@ while [ -n "$1" ]; do
ROOM_ADD=$2
shift
;;
--dict)
[ -n "$2" ] || usage
DICT=$2
shift
;;
--games)
[ -n "$2" ] || usage
NGAMES=$2
@ -94,6 +108,8 @@ while [ -n "$1" ]; do
shift
done
[ -f $DICT ] || usage "dict $DICT not found"
if [ $DBUG ]; then
EXE="./obj_linux_memdbg/xwords"
else