mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
Complete script so it runs gtk versions one host at a time (after
connecting) to test the relay's new disconnected message-storing feature. Works except when the gtk client crashes, which is a lot.
This commit is contained in:
parent
4025c37604
commit
8be09b3fc4
2 changed files with 33 additions and 28 deletions
|
@ -1,13 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
HOST_COUNTER=0
|
HOST_COUNTER=0
|
||||||
NGAMES=1 # games, not hosts
|
NGAMES=5 # games, not hosts
|
||||||
SAME_ROOM="" # unset means use different
|
SAME_ROOM="" # unset means use different
|
||||||
DICT=./dict.xwd
|
DICT=./dict.xwd
|
||||||
HOST=localhost
|
HOST=localhost
|
||||||
PORT=10999
|
PORT=10999
|
||||||
XWORDS=./obj_linux_memdbg/xwords
|
XWORDS=./obj_linux_memdbg/xwords
|
||||||
WAIT=10
|
WAIT=3
|
||||||
|
#CURSES_ARGS="-u -0"
|
||||||
|
|
||||||
RUN_NAME=$(basename $0)/_$$
|
RUN_NAME=$(basename $0)/_$$
|
||||||
|
|
||||||
|
@ -17,7 +18,6 @@ exec_cmd() {
|
||||||
CMD="$1"
|
CMD="$1"
|
||||||
LOG="$2"
|
LOG="$2"
|
||||||
[ -z "$LOG" ] && LOG=/dev/null
|
[ -z "$LOG" ] && LOG=/dev/null
|
||||||
echo "launching: $CMD"
|
|
||||||
exec $CMD </dev/null >/dev/null 2>>$LOG
|
exec $CMD </dev/null >/dev/null 2>>$LOG
|
||||||
echo "got here???"
|
echo "got here???"
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,25 @@ run_game_set() {
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
# Now launch them again
|
# Now loop, running and killing each in turn, until the game is
|
||||||
|
# finished. Eventually I'll need to deal with games that don't
|
||||||
|
# finish correctly!
|
||||||
|
|
||||||
for JJ in $(seq 0 $((${#GAME_STR}-1))); do
|
while [ -z "$GAME_DONE" ]; do
|
||||||
exec_cmd "${CMDS[$JJ]}" "${LOGS[$JJ]}" &
|
for JJ in $(seq 0 $((${#GAME_STR}-1))); do
|
||||||
PIDS[$JJ]=$!
|
exec_cmd "${CMDS[$JJ]}" "${LOGS[$JJ]}" &
|
||||||
|
PID=$!
|
||||||
|
|
||||||
|
sleep $((WAIT+2))
|
||||||
|
|
||||||
|
kill $PID
|
||||||
|
|
||||||
|
if check_logs_done ${LOGS[*]}; then
|
||||||
|
echo "game looks done: ${LOGS[*]}"
|
||||||
|
GAME_DONE=TRUE
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -88,26 +102,6 @@ for II in $(seq $NGAMES); do
|
||||||
|
|
||||||
run_game_set $GAME_STR $INDX &
|
run_game_set $GAME_STR $INDX &
|
||||||
INDX=$((INDX+4))
|
INDX=$((INDX+4))
|
||||||
|
|
||||||
# for JJ in $(seq ${#GAME_STR}); do
|
|
||||||
# CMDS[$HOST_COUNTER]=$(cmd_for $GAME_STR $(($JJ-1)) $ROOM $LOG)
|
|
||||||
# echo "${CMDS[$HOST_COUNTER]}"
|
|
||||||
# HOST_COUNTER=$((HOST_COUNTER+1))
|
|
||||||
# done
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# for II in $(seq 0 $((HOST_COUNTER-1))); do
|
|
||||||
# LOG=$(log_name $HOST_COUNTER)
|
|
||||||
# exec_cmd "${CMDS[$II]}" $LOG &
|
|
||||||
# PIDS[$II]=$!
|
|
||||||
# sleep 2
|
|
||||||
# done
|
|
||||||
|
|
||||||
# sleep 10
|
|
||||||
|
|
||||||
# for II in $(seq 0 $((HOST_COUNTER-1))); do
|
|
||||||
# echo "kill ${PIDS[$II]}"
|
|
||||||
# kill ${PIDS[$II]}
|
|
||||||
# done
|
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
|
@ -42,7 +42,7 @@ cmd_for() {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RESULT="$XWORDS -d $DICT -a $HOST -p $PORT -u -0 -C $ROOM -q 2 -z 0:$WAIT"
|
RESULT="$XWORDS -d $DICT -a $HOST -p $PORT $CURSES_ARGS -C $ROOM -q 2 -z 0:$WAIT"
|
||||||
RESULT="${RESULT} $LOCALS $HOSTSTR"
|
RESULT="${RESULT} $LOCALS $HOSTSTR"
|
||||||
[ -n "$GAME" ] && RESULT="$RESULT -f $GAME"
|
[ -n "$GAME" ] && RESULT="$RESULT -f $GAME"
|
||||||
echo "$RESULT"
|
echo "$RESULT"
|
||||||
|
@ -59,3 +59,14 @@ game_name() {
|
||||||
INDX=${1:-0}
|
INDX=${1:-0}
|
||||||
echo "/tmp/$RUN_NAME/game_${INDX}.xwg"
|
echo "/tmp/$RUN_NAME/game_${INDX}.xwg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_logs_done() {
|
||||||
|
ERR=0
|
||||||
|
for LOG in "$*"; do
|
||||||
|
if ! grep -q XWPROTO_END_GAME $LOG; then
|
||||||
|
ERR=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return $ERR
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue