From 9c586efb02da5a8aae262c97feb8c94aec3a3b91 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Fri, 30 Sep 2011 05:43:24 -0700 Subject: [PATCH] new script for testing this branch's changes: replying to messages delivered in the background. --- xwords4/linux/scripts/test_backsend.sh | 55 ++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 xwords4/linux/scripts/test_backsend.sh diff --git a/xwords4/linux/scripts/test_backsend.sh b/xwords4/linux/scripts/test_backsend.sh new file mode 100755 index 000000000..756f4be15 --- /dev/null +++ b/xwords4/linux/scripts/test_backsend.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +#set -u +set -e -u + +PID=$$ +echo "pid: $PID" + +ROOM=ROOM_$PID +DIR=$(basename $0)_$PID +DICT=dict.xwd + +APP=./obj_linux_memdbg/xwords +COMMON_ARGS="--room $ROOM --curses --robot Eric --remote-player --game-dict $DICT --quit-after 2" + +mkdir -p $DIR + +# Run once to connect each with the relay +for NUM in $(seq 1 2); do + LOG=$DIR/game_${NUM}.log + $APP $COMMON_ARGS --file $DIR/game_${NUM}.xwg > /dev/null 2>$LOG & + PID1=$! + sleep 2 + kill $PID1 + wait $PID1 +done + +# run apps until done +NBS=$DIR/nbs +while :; do + for NUM in $(seq 1 2); do + echo "running for $NUM" + LOG=$DIR/game_${NUM}.log + RELAYID=$(./scripts/relayID.sh --short $LOG) + MSG_COUNT=$(../relay/rq -m $RELAYID 2>/dev/null | sed 's,^.*-- ,,') + if [ "$MSG_COUNT" -gt 0 ]; then + echo "calling $APP" + $APP $COMMON_ARGS --file $DIR/game_${NUM}.xwg \ + --with-nbs $NBS > /dev/null & + PID1=$! + + sleep 1 # let server get ready + echo "calling rq" + ../relay/rq -f $RELAYID -b $NBS + + sleep 2 + kill $PID1 || true + wait $PID1 + else + echo "$MSG_COUNT messages for $RELAYID" + fi + done +done + +echo "$0 done (pid: $PID)"