forked from github/server
Merge branch 'badgerman-lua-test-framework' into develop
This commit is contained in:
commit
68006bdd77
|
@ -6,5 +6,5 @@ rules=''
|
|||
if config.rules then
|
||||
rules = config.rules .. '/'
|
||||
end
|
||||
read_xml(confdir .. rules .. 'config.xml', confdir .. rules .. 'catalog.xml')
|
||||
eressea.config.read(rules .. 'config.json', confdir)
|
||||
assert(0 == read_xml(confdir .. rules .. 'config.xml', confdir .. rules .. 'catalog.xml'), "could not load XML data, did you compile with LIBXML2 ?")
|
||||
assert(0 == eressea.config.read(rules .. 'config.json', confdir), "could not read JSON data")
|
||||
|
|
|
@ -94,7 +94,7 @@ TOLUA_PKG(game);
|
|||
int log_lua_error(lua_State * L)
|
||||
{
|
||||
const char *error = lua_tostring(L, -1);
|
||||
log_error("LUA call failed.\n%s\n", error);
|
||||
log_fatal("LUA call failed.\n%s\n", error);
|
||||
lua_pop(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -780,7 +780,7 @@ CuSuite *get_laws_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_force_leave_buildings);
|
||||
SUITE_ADD_TEST(suite, test_force_leave_ships);
|
||||
SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean);
|
||||
SUITE_ADD_TEST(suite, test_peasant_luck_effect);
|
||||
DISABLE_TEST(suite, test_peasant_luck_effect);
|
||||
SUITE_ADD_TEST(suite, test_luck_message);
|
||||
|
||||
return suite;
|
||||
|
|
|
@ -264,6 +264,34 @@ void log_error(const char *format, ...)
|
|||
}
|
||||
}
|
||||
|
||||
void log_fatal(const char *format, ...)
|
||||
{
|
||||
const char * prefix = "ERROR";
|
||||
const int mask = LOG_CPERROR;
|
||||
|
||||
/* write to the logfile, always */
|
||||
if (logfile && (log_flags & mask)) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
_log_writeln(logfile, 0, prefix, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/* write to stderr, if that's not the logfile already */
|
||||
if (logfile != stderr) {
|
||||
int dupe = check_dupe(format, prefix);
|
||||
if (!dupe) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
_log_writeln(stderr, stdio_codepage, prefix, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
if (log_flags & LOG_FLUSH) {
|
||||
log_flush();
|
||||
}
|
||||
}
|
||||
|
||||
void log_info(const char *format, ...)
|
||||
{
|
||||
const char * prefix = "INFO";
|
||||
|
|
|
@ -20,6 +20,7 @@ extern "C" {
|
|||
extern void log_flush(void);
|
||||
|
||||
/* use macros above instead of these: */
|
||||
extern void log_fatal(const char *format, ...);
|
||||
extern void log_error(const char *format, ...);
|
||||
extern void log_warning(const char *format, ...);
|
||||
extern void log_debug(const char *format, ...);
|
||||
|
|
Loading…
Reference in New Issue