From 5bec10048bfa86470c238eb936d7146a36498f32 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 20 Jun 2013 06:45:51 -0700 Subject: [PATCH] add --clean-start option to speed testing --- xwords4/linux/scripts/discon_ok2.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xwords4/linux/scripts/discon_ok2.sh b/xwords4/linux/scripts/discon_ok2.sh index 7abda93ab..12b4b9c19 100755 --- a/xwords4/linux/scripts/discon_ok2.sh +++ b/xwords4/linux/scripts/discon_ok2.sh @@ -1,6 +1,7 @@ #!/bin/bash set -u -e +LOGDIR=$(basename $0)_logs APP_NEW="" APP_NEW_PARAMS="" NGAMES="" @@ -39,6 +40,13 @@ declare -a APPS_OLD declare -a DICTS declare -A CHECKED_ROOMS +function cleanup() { + echo "cleaning everything up...." + rm -f $(dirname $0)/../../relay/xwrelay.log + rm -rf ${LOGDIR} + echo "delete from games;" | psql -q -t xwgames +} + function connName() { LOG=$1 grep 'got_connect_cmd: connName' $LOG | \ @@ -514,6 +522,7 @@ function getArg() { function usage() { [ $# -gt 0 ] && echo "Error: $1" >&2 echo "Usage: $(basename $0) \\" >&2 + echo " [--clean-start] \\" >&2 echo " [--game-dict ]* \\" >&2 echo " [--old-app &2 echo " [--new-app &2 @@ -538,6 +547,9 @@ function usage() { while [ "$#" -gt 0 ]; do case $1 in + --clean-start) + cleanup + ;; --num-games) NGAMES=$(getArg $*) shift @@ -620,7 +632,6 @@ done [ -n "$SEED" ] && RANDOM=$SEED [ -z "$ONEPER" -a $NROOMS -lt $NGAMES ] && usage "use --one-per if --num-rooms < --num-games" -LOGDIR=$(basename $0)_logs RESUME="" for FILE in $(ls $LOGDIR/*.{xwg,txt} 2>/dev/null); do if [ -e $FILE ]; then