From 09336e35e890d4151ba1c09e5257f975109ed780 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 1 Jun 2012 17:59:01 -0700 Subject: [PATCH] make tests do not write a logfile during tests --- Makefile | 11 +++++++---- src/main.c | 10 +++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 22ff654b5..a44c760cf 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,15 @@ -all: bin/example +all: tests + +tests: bin/server + @bin/server -l/dev/null --tests bin: - mkdir bin + @mkdir bin -bin/example: bin/Makefile +bin/server: bin/Makefile cd bin ; make -bin/Makefile: bin +bin/Makefile: CMakeLists.txt | bin cd bin ; cmake .. clean: diff --git a/src/main.c b/src/main.c index 33d6ab58a..eb1f7f6f9 100644 --- a/src/main.c +++ b/src/main.c @@ -35,6 +35,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. static const char *luafile = "setup.lua"; static const char *entry_point = NULL; static const char *inifile = "eressea.ini"; +static const char *logfile="eressea.log"; static int memdebug = 0; static void parse_config(const char *filename) @@ -96,6 +97,9 @@ static int parse_args(int argc, char **argv, int *exitcode) case 'C': entry_point = NULL; break; + case 'l': + logfile = argv[i][2] ? argv[i]+2 : argv[++i]; + break; case 'e': entry_point = argv[i][2] ? argv[i]+2 : argv[++i]; break; @@ -157,14 +161,14 @@ int main(int argc, char **argv) parse_config(inifile); - log_open("eressea.log"); - locale_init(); - err = parse_args(argc, argv, &result); if (err) { return result; } + log_open(logfile); + locale_init(); + err = eressea_init(); if (err) { log_error("initialization failed with code %d\n", err);