From 12c3324850de242cf5add5d9fcd4b76fd4c5cf58 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 27 Feb 2011 00:11:34 -0800 Subject: [PATCH] When running --tests, messages cannot be created (externally defined), so that isn't an error we are interested in. --- src/kernel/message.c | 2 +- src/tests.c | 4 ++++ src/util/log.c | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/kernel/message.c b/src/kernel/message.c index 67ccadfa3..3bcf10e64 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -140,7 +140,7 @@ msg_message(const char * name, const char* sig, ...) memset(args, 0, sizeof(args)); if (!mtype) { - log_error(("trying to create message of unknown type \"%s\"\n", name)); + log_warning(("trying to create message of unknown type \"%s\"\n", name)); if (strcmp(name, "missing_message")!=0) { return msg_message("missing_message", "name", name); } diff --git a/src/tests.c b/src/tests.c index 5a7695c97..ca5497d25 100644 --- a/src/tests.c +++ b/src/tests.c @@ -24,7 +24,9 @@ CuSuite* get_laws_suite(void); int RunAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); + int flags = log_flags; + log_flags = LOG_FLUSH|LOG_CPERROR; init_resources(); CuSuiteAddSuite(suite, get_base36_suite()); @@ -37,6 +39,8 @@ int RunAllTests(void) { CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); + + log_flags = flags; return suite->failCount; } diff --git a/src/util/log.c b/src/util/log.c index 7b5b22ff6..93203d54a 100644 --- a/src/util/log.c +++ b/src/util/log.c @@ -161,19 +161,19 @@ check_dupe(const char * format, const char * type) void _log_warn(const char * format, ...) { - int dupe = check_dupe(format, "WARNING"); + if (log_flags & LOG_CPWARNING) { + int dupe = check_dupe(format, "WARNING"); - fflush(stdout); - if (!logfile) logfile = stderr; - if (logfile!=stderr) { - va_list marker; - fputs("WARNING: ", logfile); - va_start(marker, format); - vfprintf(logfile, format, marker); - va_end(marker); - } - if (!dupe) { - if (log_flags & LOG_CPWARNING) { + fflush(stdout); + if (!logfile) logfile = stderr; + if (logfile!=stderr) { + va_list marker; + fputs("WARNING: ", logfile); + va_start(marker, format); + vfprintf(logfile, format, marker); + va_end(marker); + } + if (!dupe) { va_list marker; fputs("WARNING: ", stderr); va_start(marker, format);