[glib/glib-2-30] gdbus-exit-on-close test: optionally be more verbose for debugging
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-30] gdbus-exit-on-close test: optionally be more verbose for debugging
- Date: Fri, 11 Nov 2011 16:07:09 +0000 (UTC)
commit 1bf29ab9548b38414bf4edad629871a821b4013d
Author: Simon McVittie <simon mcvittie collabora co uk>
Date: Thu Nov 3 18:32:53 2011 +0000
gdbus-exit-on-close test: optionally be more verbose for debugging
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
Reviewed-by: Colin Walters <walters verbum org>
gio/tests/gdbus-exit-on-close.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/gdbus-exit-on-close.c b/gio/tests/gdbus-exit-on-close.c
index 14ee503..a5e552d 100644
--- a/gio/tests/gdbus-exit-on-close.c
+++ b/gio/tests/gdbus-exit-on-close.c
@@ -72,6 +72,12 @@ closed_cb (GDBusConnection *c G_GNUC_UNUSED,
{
const TestData *td = test_data;
+ if (error == NULL)
+ g_debug ("closed (%d, no error)", remote_peer_vanished);
+ else
+ g_debug ("closed (%d, %s %d \"%s\")", remote_peer_vanished,
+ g_quark_to_string (error->domain), error->code, error->message);
+
g_assert_cmpint (remote_peer_vanished, ==, (td->who_closes == REMOTE));
g_assert_cmpint ((error == NULL), ==, (td->who_closes == LOCAL));
@@ -86,12 +92,27 @@ close_async_cb (GObject *source G_GNUC_UNUSED,
GAsyncResult *res G_GNUC_UNUSED,
gpointer nil G_GNUC_UNUSED)
{
+ GError *error = NULL;
+
+ if (g_dbus_connection_close_finish (G_DBUS_CONNECTION (source),
+ res,
+ &error))
+ {
+ g_debug ("closed connection");
+ }
+ else
+ {
+ g_warning ("failed to close connection: %s (%s #%d)",
+ error->message, g_quark_to_string (error->domain),
+ error->code);
+ }
}
static void
test_exit_on_close (gconstpointer test_data)
{
const TestData *td = test_data;
+ GTestTrapFlags silence;
/* all the tests rely on a shared main loop */
loop = g_main_loop_new (NULL, FALSE);
@@ -102,7 +123,12 @@ test_exit_on_close (gconstpointer test_data)
g_unsetenv ("DISPLAY");
g_setenv ("DBUS_SESSION_BUS_ADDRESS", session_bus_get_temporary_address (), TRUE);
- if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+ if (g_test_verbose ())
+ silence = 0;
+ else
+ silence = G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR;
+
+ if (g_test_trap_fork (0, silence))
{
GDBusConnection *c;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]