[glib] Silence log handler tests
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Silence log handler tests
- Date: Fri, 30 Jul 2010 23:57:23 +0000 (UTC)
commit 2b113e4a9ad375691d72347d31999fd5654f5361
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jul 26 23:06:33 2010 -0400
Silence log handler tests
glib/tests/testing.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/glib/tests/testing.c b/glib/tests/testing.c
index ef8bcf9..6b5be0b 100644
--- a/glib/tests/testing.c
+++ b/glib/tests/testing.c
@@ -45,6 +45,7 @@ test_assertions (void)
g_assert_cmpstr ("foo", <, "fzz");
g_assert_cmpstr ("fzz", >, "faa");
g_assert_cmpstr ("fzz", ==, "fzz");
+
}
/* test g_test_timer* API */
@@ -201,18 +202,23 @@ fatal_handler (const gchar *log_domain,
}
static void
-test_log_handler (void)
+test_fatal_log_handler (void)
{
g_test_log_set_fatal_handler (fatal_handler, NULL);
- g_str_has_prefix (NULL, "file://");
- g_critical ("Test passing");
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+ {
+ g_str_has_prefix (NULL, "file://");
+ g_critical ("Test passing");
+ exit (0);
+ }
+ g_test_trap_assert_passed ();
g_test_log_set_fatal_handler (NULL, NULL);
- if (g_test_trap_fork (0, 0))
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
g_error ("Test failing");
g_test_trap_assert_failed ();
- if (g_test_trap_fork (0, 0))
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
g_str_has_prefix (NULL, "file://");
g_test_trap_assert_failed ();
}
@@ -235,7 +241,7 @@ main (int argc,
g_test_add_func ("/forking/patterns", test_fork_patterns);
if (g_test_slow())
g_test_add_func ("/forking/timeout", test_fork_timeout);
- g_test_add_func ("/misc/log-handler", test_log_handler);
+ g_test_add_func ("/misc/fatal-log-handler", test_fatal_log_handler);
return g_test_run();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]