tweaks to test script

This commit is contained in:
Eric House 2017-10-28 15:31:17 -07:00
parent e3b2a0e4e1
commit 3215affd68

View file

@ -2,6 +2,42 @@
set -e -u
IN_SEQ=''
HTTP=''
usage() {
[ $# -gt 0 ] && echo "ERROR: $1"
echo "usage: $0 --in-sequence|--at-once [--use-http]"
cat <<EOF
Starts a pair of devices meant to get into the same game. Verification
is by looking at the relay, usually with
./relay/scripts/showinplay.sh. Both should have an 'A' in the ACK
column.
EOF
exit 1
}
while [ $# -gt 0 ]; do
case $1 in
--in-sequence)
IN_SEQ=1
;;
--at-once)
IN_SEQ=0
;;
--use-http)
HTTP=--use-http
;;
*)
usage "unexpected param $1"
;;
esac
shift
done
[ -n "$IN_SEQ" ] || usage "missing required param"
DB_TMPLATE=_cursesdb_
LOG_TMPLATE=_curseslog_
ROOM_TMPLATE=cursesRoom
@ -15,23 +51,27 @@ rm -f ${LOG_TMPLATE}*
PIDS=''
for GAME in $(seq 1); do
ROOM=${ROOM_TMPLATE}${GAME}
# for N in $(seq 2); do
for N in $(seq 1); do
for N in $(seq 2); do
# for N in $(seq 1); do
DB=$DB_TMPLATE${GAME}_${N}.sqldb
LOG=$LOG_TMPLATE${GAME}_${N}.log
exec ./obj_linux_memdbg/xwords --server --curses --remote-player --name Player \
--room $ROOM --game-dict dict.xwd \
--room $ROOM --game-dict dict.xwd $HTTP\
--skip-confirm --db $DB --close-stdin --server \
>/dev/null 2>>$LOG &
PIDS="$PIDS $!"
PID=$!
echo "launched $PID"
if [ $IN_SEQ -eq 1 ]; then
sleep 9
kill $PID
sleep 1
elif [ $IN_SEQ -eq 0 ]; then
PIDS="$PIDS $PID"
fi
done
done
echo "launched $PIDS"
# --use-http \
sleep 10
[ -n "${PIDS}" ] && sleep 10
for PID in $PIDS; do
kill $PID
done