test script; log threadid

This commit is contained in:
Eric House 2017-10-27 05:57:40 -07:00
parent 3645331061
commit a8f06b53e2
2 changed files with 39 additions and 2 deletions

View file

@ -50,8 +50,8 @@ linux_debugf( const char* format, ... )
gettimeofday( &tv, &tz );
timp = localtime( &tv.tv_sec );
size_t len = snprintf( buf, sizeof(buf), "<%d>%.2d:%.2d:%.2d:", getpid(),
timp->tm_hour, timp->tm_min, timp->tm_sec );
size_t len = snprintf( buf, sizeof(buf), "<%d:%lu>%.2d:%.2d:%.2d:", getpid(),
pthread_self(), timp->tm_hour, timp->tm_min, timp->tm_sec );
XP_ASSERT( len < sizeof(buf) );
va_start(ap, format);

View file

@ -0,0 +1,37 @@
#!/bin/sh
set -e -u
DB_TMPLATE=_cursesdb_
LOG_TMPLATE=_curseslog_
ROOM_TMPLATE=cursesRoom
echo "delete from msgs;" | psql xwgames
echo "delete from games where room like '$ROOM_TMPLATE%';" | psql xwgames
rm -f ${DB_TMPLATE}*.sqldb
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
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 \
--skip-confirm --db $DB --close-stdin --server \
>/dev/null 2>>$LOG &
PIDS="$PIDS $!"
done
done
echo "launched $PIDS"
# --use-http \
sleep 10
for PID in $PIDS; do
kill $PID
done