don't treat debug/info/message as fatal messages by default

* glib/gtestutils.c: don't treat non-fatal messages as errors
* glib/tests/.gitignore: silence
* glib/tests/Makefile.am: updated
* glib/tests/protocol.c: add a test for the message treatment
This commit is contained in:
Sven Herzberg
2010-04-20 15:01:17 +02:00
parent 60a5b19799
commit 6c02c99df0
4 changed files with 348 additions and 5 deletions

View File

@@ -1264,6 +1264,7 @@ gtest_default_log_handler (const gchar *log_domain,
gpointer unused_data)
{
const gchar *strv[16];
gboolean fatal = FALSE;
gchar *msg;
guint i = 0;
if (log_domain)
@@ -1272,7 +1273,10 @@ gtest_default_log_handler (const gchar *log_domain,
strv[i++] = "-";
}
if (log_level & G_LOG_FLAG_FATAL)
strv[i++] = "FATAL-";
{
strv[i++] = "FATAL-";
fatal = TRUE;
}
if (log_level & G_LOG_FLAG_RECURSION)
strv[i++] = "RECURSIVE-";
if (log_level & G_LOG_LEVEL_ERROR)
@@ -1291,7 +1295,7 @@ gtest_default_log_handler (const gchar *log_domain,
strv[i++] = message;
strv[i++] = NULL;
msg = g_strjoinv ("", (gchar**) strv);
g_test_log (G_TEST_LOG_ERROR, msg, NULL, 0, NULL);
g_test_log (fatal ? G_TEST_LOG_ERROR : G_TEST_LOG_MESSAGE, msg, NULL, 0, NULL);
g_log_default_handler (log_domain, log_level, message, unused_data);
g_free (msg);
}