forked from github/server
add missing .sh files to git (previously blocked by .gitignore)
add an integration test for run-turn.lua
This commit is contained in:
parent
b6ba42c3de
commit
bf86b1d66a
|
@ -19,7 +19,6 @@ ipch/
|
|||
*.opensdf
|
||||
*.pdb
|
||||
*.sdf
|
||||
*.sh
|
||||
*.suo
|
||||
*.user
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z $ERESSEA ]; then
|
||||
echo "You need to define the \$ERESSEA environment variable to run $0"
|
||||
exit -2
|
||||
fi
|
||||
|
||||
GAME=$ERESSEA/game-$1
|
||||
GAME_NAME=$(grep name $GAME/eressea.ini | sed 's/.*=\s*//')
|
||||
|
||||
TURN=$2
|
||||
if [ -z $TURN ]
|
||||
then
|
||||
TURN=`cat $GAME/turn`
|
||||
fi
|
||||
|
||||
if [ ! -d $GAME/reports ]; then
|
||||
echo "cannot find reprts directory in $GAME"
|
||||
exit
|
||||
fi
|
||||
|
||||
cd $GAME/reports
|
||||
compress.py $TURN "$GAME_NAME"
|
||||
cd -
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
PATH=$ERESSEA/bin:$PATH
|
||||
|
||||
function abort() {
|
||||
if [ $# -gt 0 ]; then
|
||||
echo $@
|
||||
fi
|
||||
exit -1
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
ls -1 orders.dir/turn* | sed -e 's/.*turn-\(.*\),gruenbaer.*/\1/' | sort -u
|
|
@ -0,0 +1 @@
|
|||
grep -hiw ERESSEA orders.dir/turn-* | cut -d\ -f2 | sort -u
|
|
@ -0,0 +1,22 @@
|
|||
GAME=$1
|
||||
TURN=$2
|
||||
|
||||
if [ ! -d $ERESSEA/game-$GAME ] ; then
|
||||
echo "No such game: $GAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $ERESSEA/game-$GAME
|
||||
if [ -z $TURN ]; then
|
||||
TURN=$(cat turn)
|
||||
fi
|
||||
|
||||
echo "running turn $TURN, game $GAME"
|
||||
if [ -d orders.dir.$TURN ]; then
|
||||
echo "orders.dir.$TURN already exists"
|
||||
else
|
||||
mv orders.dir orders.dir.$TURN
|
||||
mkdir -p orders.dir
|
||||
fi
|
||||
ls -1rt orders.dir.$TURN/turn-* | xargs cat > orders.$TURN
|
||||
$ERESSEA/bin/eressea -t $TURN run-turn.lua
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
##
|
||||
## Prepare the report
|
||||
|
||||
if [ -z $ERESSEA ]; then
|
||||
echo "You have to define the \$ERESSEA environment variable to run $0"
|
||||
exit -2
|
||||
fi
|
||||
source $HOME/bin/functions.sh
|
||||
source $ERESSEA/etc/eressea.conf
|
||||
|
||||
if [ ! -z $1 ]; then
|
||||
GAME=$ERESSEA/game-$1
|
||||
else
|
||||
GAME=$ERESSEA
|
||||
fi
|
||||
|
||||
cd $GAME/reports || abort "could not chdir to reports directory"
|
||||
for REPORT in *.sh
|
||||
do
|
||||
echo -n "Sending "
|
||||
basename $REPORT .sh
|
||||
bash $REPORT
|
||||
done
|
||||
cd -
|
||||
|
||||
if [ -e $GAME/ages.sh ]; then
|
||||
cd $GAME
|
||||
./ages.sh
|
||||
cd -
|
||||
fi
|
||||
|
|
@ -19,3 +19,4 @@ inifile
|
|||
s/runtests
|
||||
cd tests
|
||||
./write-reports.sh
|
||||
./run-turn.sh
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
NEWFILES="data/185.dat datum parteien parteien.full passwd score turn"
|
||||
cleanup () {
|
||||
rm -rf reports $NEWFILES
|
||||
}
|
||||
|
||||
setup() {
|
||||
ln -sf ../scripts/config.lua
|
||||
}
|
||||
|
||||
quit() {
|
||||
test -n "$2" && echo $2
|
||||
exit $1
|
||||
}
|
||||
|
||||
ROOT=`pwd`
|
||||
while [ ! -d $ROOT/.git ]; do
|
||||
ROOT=`dirname $ROOT`
|
||||
done
|
||||
|
||||
set -e
|
||||
cd $ROOT/tests
|
||||
setup
|
||||
cleanup
|
||||
VALGRIND=`which valgrind`
|
||||
SERVER=../Debug/eressea/eressea
|
||||
if [ -n "$VALGRIND" ]; then
|
||||
SUPP=../share/ubuntu-12_04.supp
|
||||
SERVER="$VALGRIND --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER"
|
||||
fi
|
||||
echo "running $SERVER"
|
||||
$SERVER -t 184 ../scripts/run-turn.lua
|
||||
[ -d reports ] || quit 4 "no reports directory created"
|
||||
CRFILE=185-zvto.cr
|
||||
for file in $NEWFILES reports/$CRFILE ; do
|
||||
[ -e $file ] || quit 5 "did not create $file"
|
||||
done
|
||||
grep -q PARTEI reports/$CRFILE || quit 1 "CR did not contain any factions"
|
||||
grep -q REGION reports/$CRFILE || quit 2 "CR did not contain any regions"
|
||||
grep -q SCHIFF reports/$CRFILE || quit 3 "CR did not contain any ships"
|
||||
grep -q BURG reports/$CRFILE || quit 4 "CR did not contain any buildings"
|
||||
grep -q EINHEIT reports/$CRFILE || quit 5 "CR did not contain any units"
|
||||
grep -q GEGENSTAENDE reports/$CRFILE || quit 6 "CR did not contain any items"
|
||||
echo "integration tests: PASS"
|
||||
cleanup
|
Loading…
Reference in New Issue