From 652136ee462658b6552285ca5e01712bd608f5b0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 9 Feb 2016 16:32:01 +0100 Subject: [PATCH 1/6] unused variable, kill --- src/util/attrib.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/util/attrib.c b/src/util/attrib.c index 3b6f252d4..b5ea3ad3c 100644 --- a/src/util/attrib.c +++ b/src/util/attrib.c @@ -338,9 +338,7 @@ static int a_read_i(struct storage *store, attrib ** attribs, void *owner, unsig int a_read(struct storage *store, attrib ** attribs, void *owner) { int key, retval = AT_READ_OK; - char zText[128]; - zText[0] = 0; key = -1; READ_INT(store, &key); while (key > 0) { From ca6448ec2323f7b8f89fbda963033a730e179545 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 9 Feb 2016 17:18:09 +0100 Subject: [PATCH 2/6] re-enable failing valgrind check with more flags --- s/travis-build | 2 +- tests/run-turn.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/s/travis-build b/s/travis-build index 17c17fb10..414a70f80 100755 --- a/s/travis-build +++ b/s/travis-build @@ -19,4 +19,4 @@ inifile s/runtests cd tests ./write-reports.sh -#./run-turn.sh +./run-turn.sh diff --git a/tests/run-turn.sh b/tests/run-turn.sh index 4055613e5..91c79a8df 100755 --- a/tests/run-turn.sh +++ b/tests/run-turn.sh @@ -34,7 +34,7 @@ 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" +SERVER="$VALGRIND --track-origins=yes --gen-suppressions=all --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER" fi echo "running $SERVER" $SERVER -t 184 ../scripts/run-turn.lua From 50f22d7c2f34333ca4f651b1936886d28e58d73f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 9 Feb 2016 18:20:01 +0100 Subject: [PATCH 3/6] debug output --- tests/run-turn.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/run-turn.sh b/tests/run-turn.sh index 91c79a8df..2d19e03f7 100755 --- a/tests/run-turn.sh +++ b/tests/run-turn.sh @@ -19,6 +19,7 @@ expr=$2 expect=$3 count=`grep -cE $expr $file` [ $count -eq $expect ] || quit 1 "expected $expect counts of $expr in $file, got $count" +echo "PASS: $expr is $expect" } ROOT=`pwd` @@ -38,6 +39,7 @@ SERVER="$VALGRIND --track-origins=yes --gen-suppressions=all --suppressions=$SUP fi echo "running $SERVER" $SERVER -t 184 ../scripts/run-turn.lua +echo "integration tests" [ -d reports ] || quit 4 "no reports directory created" CRFILE=185-zvto.cr for file in $NEWFILES reports/$CRFILE ; do From 3ee023cdd679e2346805afbe5916d6c5c001342f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 9 Feb 2016 18:30:42 +0100 Subject: [PATCH 4/6] it was all a lua syntax error. good grief. that should go to stderr! --- scripts/run-turn.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/run-turn.lua b/scripts/run-turn.lua index ebf6acfb7..20a8de05b 100644 --- a/scripts/run-turn.lua +++ b/scripts/run-turn.lua @@ -60,7 +60,7 @@ local function write_emails(locales) end local function join_path(a, b) - if a then return a .. '/' .. b + if a then return a .. '/' .. b end return b end @@ -99,7 +99,9 @@ local function write_htpasswd() local out = io.open(join_path(config.basepath, "htpasswd"), "w") if out then for f in factions() do - out:write(itoa36(f.id) .. ":" .. f.password .. "\n") + if f.password then + out:write(itoa36(f.id) .. ":" .. f.password .. "\n") + end end out:close() end From 91ca77bc4815ce446a72732387d8754723993b7f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 9 Feb 2016 18:34:36 +0100 Subject: [PATCH 5/6] passwd is no longer written --- tests/run-turn.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-turn.sh b/tests/run-turn.sh index 2d19e03f7..622ab68ab 100755 --- a/tests/run-turn.sh +++ b/tests/run-turn.sh @@ -1,4 +1,4 @@ -NEWFILES="data/185.dat datum parteien parteien.full passwd score turn" +NEWFILES="data/185.dat datum parteien parteien.full htpasswd score turn" cleanup () { rm -rf reports $NEWFILES } From 01e864273ab36d6c79f8c5b8f17d50e624627bc6 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 9 Feb 2016 21:34:24 +0100 Subject: [PATCH 6/6] crash with an assert if Lua code has syntax errors. this addresses issue #474 also, correct capitalization of Lua. --- src/bindings.c | 3 ++- src/modules/museum.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bindings.c b/src/bindings.c index 99458c08d..72f14103d 100755 --- a/src/bindings.c +++ b/src/bindings.c @@ -96,7 +96,7 @@ TOLUA_PKG(game); int log_lua_error(lua_State * L) { const char *error = lua_tostring(L, -1); - log_fatal("LUA call failed.\n%s\n", error); + log_fatal("Lua call failed.\n%s\n", error); lua_pop(L, 1); return 1; } @@ -1183,6 +1183,7 @@ int eressea_run(lua_State *L, const char *luafile) err = lua_pcall(L, 1, 1, -3); if (err != 0) { log_lua_error(L); + assert(!"Lua syntax error? check log."); } else { if (lua_isnumber(L, -1)) { diff --git a/src/modules/museum.c b/src/modules/museum.c index e1e7d33e5..516bf775f 100644 --- a/src/modules/museum.c +++ b/src/modules/museum.c @@ -194,7 +194,7 @@ void warden_add_give(unit * src, unit * u, const item_type * itype, int n) void create_museum(void) { -#if 0 /* TODO: move this to LUA. It should be possible. */ +#if 0 /* TODO: move this to Lua. It should be possible. */ unsigned int museum_id = hashstring("museum"); plane *museum = getplanebyid(museum_id); region *r;