add a script that runs all tests

clean up the build scripta bit
bind ship type
This commit is contained in:
Enno Rehling 2014-04-12 05:25:21 +02:00
parent 9aeb0f6b86
commit ae68a1beaf
4 changed files with 36 additions and 4 deletions

2
cutest

@ -1 +1 @@
Subproject commit d83cec09a52835274ab8ed4849de16fb8658982a Subproject commit 788659594ef87e9f497b8039da764182adfd2943

View File

@ -4,9 +4,12 @@ while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT) ROOT=$(dirname $ROOT)
done done
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BIN_DIR="build-$MACHINE-$CC-Debug"
[ -z "$JOBS" ] && JOBS=$(nproc) [ -z "$JOBS" ] && JOBS=$(nproc)
DISTCC=`which distcc` DISTCC=`which distcc`
if [ ! -z "$DISTCC" ] ; then if [ ! -z "$DISTCC" ] ; then
@ -20,8 +23,6 @@ fi
fi fi
echo "Building with $CC and $JOBS jobs" echo "Building with $CC and $JOBS jobs"
MACHINE=`uname -m`
BIN_DIR="build-$MACHINE-$CC-Debug"
if [ ! -d $ROOT/$BIN_DIR ]; then if [ ! -d $ROOT/$BIN_DIR ]; then
echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?" echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?"
exit exit

24
s/runtests Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
ROOT=$(pwd)
while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT)
done
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BIN_DIR="build-$MACHINE-$CC-Debug"
if [ ! -d $ROOT/$BIN_DIR ]; then
echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?"
exit
fi
echo $ROOT
$ROOT/$BIN_DIR/eressea/test_eressea
pushd $ROOT/game-e2
$ROOT/$BIN_DIR/eressea/eressea -e run_tests
cd $ROOT/game-e3
$ROOT/$BIN_DIR/eressea/eressea -e run_tests
popd

View File

@ -177,6 +177,13 @@ static int tolua_ship_get_coast(lua_State * L)
return 0; return 0;
} }
static int tolua_ship_get_type(lua_State * L)
{
ship *self = (ship *) tolua_tousertype(L, 1, 0);
tolua_pushstring(L, self->type->name[0]);
return 1;
}
void tolua_ship_open(lua_State * L) void tolua_ship_open(lua_State * L)
{ {
/* register user types */ /* register user types */
@ -201,8 +208,8 @@ void tolua_ship_open(lua_State * L)
tolua_ship_set_region); tolua_ship_set_region);
tolua_variable(L, TOLUA_CAST "coast", tolua_ship_get_coast, tolua_variable(L, TOLUA_CAST "coast", tolua_ship_get_coast,
tolua_ship_set_coast); tolua_ship_set_coast);
tolua_variable(L, TOLUA_CAST "type", tolua_ship_get_type, 0);
#ifdef TODO #ifdef TODO
.property("type", &ship_gettype)
.property("weight", &ship_getweight) .property("weight", &ship_getweight)
.property("capacity", &ship_getcapacity) .property("capacity", &ship_getcapacity)
.property("maxsize", &ship_maxsize) .property("maxsize", &ship_maxsize)