mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
new script for testing this branch's changes: replying to
messages delivered in the background.
This commit is contained in:
parent
4a49db5c2a
commit
9c586efb02
1 changed files with 55 additions and 0 deletions
55
xwords4/linux/scripts/test_backsend.sh
Executable file
55
xwords4/linux/scripts/test_backsend.sh
Executable file
|
@ -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)"
|
Loading…
Add table
Reference in a new issue