2015-08-05 17:42:36 +02:00
|
|
|
cleanup () {
|
|
|
|
rm -rf reports score
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2015-08-05 18:19:17 +02:00
|
|
|
set -e
|
2015-08-05 17:42:36 +02:00
|
|
|
cd $ROOT/tests
|
|
|
|
setup
|
|
|
|
cleanup
|
2015-08-05 18:14:57 +02:00
|
|
|
VALGRIND=`which valgrind`
|
2015-11-07 18:04:11 +01:00
|
|
|
TESTS=../Debug/eressea/test_eressea
|
2015-08-05 18:14:57 +02:00
|
|
|
SERVER=../Debug/eressea/eressea
|
|
|
|
if [ -n "$VALGRIND" ]; then
|
2015-08-05 18:19:17 +02:00
|
|
|
SUPP=../share/ubuntu-12_04.supp
|
2015-11-07 18:04:11 +01:00
|
|
|
VALGRIND="$VALGRIND --suppressions=$SUPP --error-exitcode=1 --leak-check=no"
|
2015-08-05 18:14:57 +02:00
|
|
|
fi
|
2015-11-07 18:04:11 +01:00
|
|
|
echo "running $TESTS"
|
|
|
|
$VALGRIND $TESTS
|
2015-08-05 18:14:57 +02:00
|
|
|
echo "running $SERVER"
|
2015-11-07 18:04:11 +01:00
|
|
|
$VALGRIND $SERVER -t 184 ../scripts/reports.lua
|
2015-08-05 17:42:36 +02:00
|
|
|
[ -d reports ] || quit 4 "no reports directory created"
|
|
|
|
CRFILE=184-zvto.cr
|
2015-08-05 18:03:43 +02:00
|
|
|
grep -q PARTEI reports/$CRFILE || quit 1 "CR did not contain any factions"
|
2015-08-05 17:42:36 +02:00
|
|
|
grep -q REGION reports/$CRFILE || quit 2 "CR did not contain any regions"
|
2015-08-05 18:03:43 +02:00
|
|
|
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"
|
2015-08-05 17:42:36 +02:00
|
|
|
echo "integration tests: PASS"
|
|
|
|
cleanup
|