2016-02-10 14:12:38 +01:00
|
|
|
NEWFILES="data/185.dat datum parteien parteien.full passwd htpasswd score turn"
|
2015-09-07 15:27:30 +02:00
|
|
|
cleanup () {
|
|
|
|
rm -rf reports $NEWFILES
|
|
|
|
}
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
ln -sf ../scripts/config.lua
|
|
|
|
}
|
|
|
|
|
|
|
|
quit() {
|
|
|
|
test -n "$2" && echo $2
|
2015-09-07 15:40:12 +02:00
|
|
|
echo "integration tests: FAILED"
|
2015-09-07 15:27:30 +02:00
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
2015-09-07 15:40:12 +02:00
|
|
|
assert_grep_count() {
|
|
|
|
file=$1
|
|
|
|
expr=$2
|
|
|
|
expect=$3
|
|
|
|
count=`grep -cE $expr $file`
|
|
|
|
[ $count -eq $expect ] || quit 1 "expected $expect counts of $expr in $file, got $count"
|
|
|
|
}
|
|
|
|
|
2015-09-07 15:27:30 +02:00
|
|
|
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"
|
2016-02-18 10:56:43 +01:00
|
|
|
$SERVER -t 184 test-turn.lua
|
2015-09-07 15:27:30 +02:00
|
|
|
[ -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
|
2015-09-07 15:40:12 +02:00
|
|
|
assert_grep_count reports/$CRFILE '^REGION' 7
|
|
|
|
assert_grep_count reports/$CRFILE '^PARTEI' 2
|
|
|
|
assert_grep_count reports/$CRFILE '^SCHIFF' 1
|
|
|
|
assert_grep_count reports/$CRFILE '^BURG' 1
|
|
|
|
assert_grep_count reports/$CRFILE '^EINHEIT' 2
|
|
|
|
assert_grep_count reports/$CRFILE '^GEGENSTAENDE' 2
|
2015-09-07 16:11:58 +02:00
|
|
|
|
|
|
|
assert_grep_count reports/185-6rLo.cr '^EINHEIT' 2
|
|
|
|
assert_grep_count reports/185-6rLo.cr '^REGION' 13
|
2015-09-07 15:27:30 +02:00
|
|
|
echo "integration tests: PASS"
|
|
|
|
cleanup
|