When running --tests, messages cannot be created (externally defined), so that isn't an error we are interested in.

This commit is contained in:
Enno Rehling 2011-02-27 00:11:34 -08:00
parent ca2556c618
commit 12c3324850
3 changed files with 17 additions and 13 deletions

View File

@ -140,7 +140,7 @@ msg_message(const char * name, const char* sig, ...)
memset(args, 0, sizeof(args)); memset(args, 0, sizeof(args));
if (!mtype) { 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) { if (strcmp(name, "missing_message")!=0) {
return msg_message("missing_message", "name", name); return msg_message("missing_message", "name", name);
} }

View File

@ -24,7 +24,9 @@ CuSuite* get_laws_suite(void);
int RunAllTests(void) { int RunAllTests(void) {
CuString *output = CuStringNew(); CuString *output = CuStringNew();
CuSuite* suite = CuSuiteNew(); CuSuite* suite = CuSuiteNew();
int flags = log_flags;
log_flags = LOG_FLUSH|LOG_CPERROR;
init_resources(); init_resources();
CuSuiteAddSuite(suite, get_base36_suite()); CuSuiteAddSuite(suite, get_base36_suite());
@ -37,6 +39,8 @@ int RunAllTests(void) {
CuSuiteSummary(suite, output); CuSuiteSummary(suite, output);
CuSuiteDetails(suite, output); CuSuiteDetails(suite, output);
printf("%s\n", output->buffer); printf("%s\n", output->buffer);
log_flags = flags;
return suite->failCount; return suite->failCount;
} }

View File

@ -161,19 +161,19 @@ check_dupe(const char * format, const char * type)
void void
_log_warn(const char * format, ...) _log_warn(const char * format, ...)
{ {
int dupe = check_dupe(format, "WARNING"); if (log_flags & LOG_CPWARNING) {
int dupe = check_dupe(format, "WARNING");
fflush(stdout); fflush(stdout);
if (!logfile) logfile = stderr; if (!logfile) logfile = stderr;
if (logfile!=stderr) { if (logfile!=stderr) {
va_list marker; va_list marker;
fputs("WARNING: ", logfile); fputs("WARNING: ", logfile);
va_start(marker, format); va_start(marker, format);
vfprintf(logfile, format, marker); vfprintf(logfile, format, marker);
va_end(marker); va_end(marker);
} }
if (!dupe) { if (!dupe) {
if (log_flags & LOG_CPWARNING) {
va_list marker; va_list marker;
fputs("WARNING: ", stderr); fputs("WARNING: ", stderr);
va_start(marker, format); va_start(marker, format);