linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests
@ 2013-01-10  1:03 Anderson Lizardo
  2013-01-10  1:03 ` [PATCH BlueZ 2/2] unit: Print D-Bus error message in verbose mode Anderson Lizardo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Anderson Lizardo @ 2013-01-10  1:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

While running tests, the D-Bus library was set to call _exit() when the
client leaves the bus. This caused the second test to be interrupted
without providing a PASS/FAIL result. This was confirmed by running
test-sdp with DBUS_VERBOSE=1.

This commit disables this behavior, which does not exist on BlueZ
because g_dbus_set_disconnect_function() implicitly does this.
---
 unit/test-gdbus-client.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/unit/test-gdbus-client.c b/unit/test-gdbus-client.c
index 7c849f0..cfbe4e0 100644
--- a/unit/test-gdbus-client.c
+++ b/unit/test-gdbus-client.c
@@ -68,6 +68,10 @@ static struct context *create_context(void)
 		return NULL;
 	}
 
+	/* Make sure D-Bus library will not call _exit() and interrupt the next
+	 * tests. */
+	dbus_connection_set_exit_on_disconnect(context->dbus_conn, FALSE);
+
 	return context;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH BlueZ 2/2] unit: Print D-Bus error message in verbose mode
  2013-01-10  1:03 [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests Anderson Lizardo
@ 2013-01-10  1:03 ` Anderson Lizardo
  2013-01-10  1:22   ` Marcel Holtmann
  2013-01-10  1:21 ` [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests Marcel Holtmann
  2013-01-10 12:30 ` [PATCH v2 BlueZ] unit: Avoid D-Bus calling _exit() during " Anderson Lizardo
  2 siblings, 1 reply; 6+ messages in thread
From: Anderson Lizardo @ 2013-01-10  1:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

If g_dbus_setup_private() fails (e.g. a session bus is not available,
and there is no X11 for dbus-launch to work), the tests are silently
skipped.

With this commit, the D-Bus error message is also printed if verbose
mode is enabled. The test is still skipped as before.
---
 unit/test-gdbus-client.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/unit/test-gdbus-client.c b/unit/test-gdbus-client.c
index cfbe4e0..5821414 100644
--- a/unit/test-gdbus-client.c
+++ b/unit/test-gdbus-client.c
@@ -53,6 +53,7 @@ static const GDBusPropertyTable properties[] = {
 static struct context *create_context(void)
 {
 	struct context *context = g_new0(struct context, 1);
+	DBusError err;
 
 	context->main_loop = g_main_loop_new(NULL, FALSE);
 	if (context->main_loop == NULL) {
@@ -60,9 +61,18 @@ static struct context *create_context(void)
 		return NULL;
 	}
 
+	dbus_error_init(&err);
+
 	context->dbus_conn = g_dbus_setup_private(DBUS_BUS_SESSION,
-							SERVICE_NAME, NULL);
+							SERVICE_NAME, &err);
 	if (context->dbus_conn == NULL) {
+		if (dbus_error_is_set(&err)) {
+			if (g_test_verbose())
+				g_printerr("D-Bus setup failed: %s\n",
+								err.message);
+			dbus_error_free(&err);
+		}
+
 		g_main_loop_unref(context->main_loop);
 		g_free(context);
 		return NULL;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests
  2013-01-10  1:03 [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests Anderson Lizardo
  2013-01-10  1:03 ` [PATCH BlueZ 2/2] unit: Print D-Bus error message in verbose mode Anderson Lizardo
@ 2013-01-10  1:21 ` Marcel Holtmann
  2013-01-10 12:30 ` [PATCH v2 BlueZ] unit: Avoid D-Bus calling _exit() during " Anderson Lizardo
  2 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2013-01-10  1:21 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Anderson,

change the subject of the commit ;)

> While running tests, the D-Bus library was set to call _exit() when the
> client leaves the bus. This caused the second test to be interrupted
> without providing a PASS/FAIL result. This was confirmed by running
> test-sdp with DBUS_VERBOSE=1.
> 
> This commit disables this behavior, which does not exist on BlueZ
> because g_dbus_set_disconnect_function() implicitly does this.
> ---
>  unit/test-gdbus-client.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/unit/test-gdbus-client.c b/unit/test-gdbus-client.c
> index 7c849f0..cfbe4e0 100644
> --- a/unit/test-gdbus-client.c
> +++ b/unit/test-gdbus-client.c
> @@ -68,6 +68,10 @@ static struct context *create_context(void)
>  		return NULL;
>  	}
>  
> +	/* Make sure D-Bus library will not call _exit() and interrupt the next
> +	 * tests. */

Can you make this a one-line comment like this or similar:

	/* Avoid D-Bus library calling _exit() before next test */
> +	dbus_connection_set_exit_on_disconnect(context->dbus_conn, FALSE);
> +
>  	return context;
>  }
>  

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH BlueZ 2/2] unit: Print D-Bus error message in verbose mode
  2013-01-10  1:03 ` [PATCH BlueZ 2/2] unit: Print D-Bus error message in verbose mode Anderson Lizardo
@ 2013-01-10  1:22   ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2013-01-10  1:22 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Anderson,

> If g_dbus_setup_private() fails (e.g. a session bus is not available,
> and there is no X11 for dbus-launch to work), the tests are silently
> skipped.
> 
> With this commit, the D-Bus error message is also printed if verbose
> mode is enabled. The test is still skipped as before.
> ---
>  unit/test-gdbus-client.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

patch has been applied.

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 BlueZ] unit: Avoid D-Bus calling _exit() during SDP tests
  2013-01-10  1:03 [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests Anderson Lizardo
  2013-01-10  1:03 ` [PATCH BlueZ 2/2] unit: Print D-Bus error message in verbose mode Anderson Lizardo
  2013-01-10  1:21 ` [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests Marcel Holtmann
@ 2013-01-10 12:30 ` Anderson Lizardo
  2013-01-10 12:31   ` Johan Hedberg
  2 siblings, 1 reply; 6+ messages in thread
From: Anderson Lizardo @ 2013-01-10 12:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

While running tests, the D-Bus library was set to call _exit() when the
client leaves the bus. This caused the second test to be interrupted
without providing a PASS/FAIL result. This was confirmed by running
test-sdp with DBUS_VERBOSE=1.

This commit disables this behavior, which does not exist on BlueZ
because g_dbus_set_disconnect_function() implicitly does this.
---
 unit/test-gdbus-client.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/unit/test-gdbus-client.c b/unit/test-gdbus-client.c
index aaf8342..34c714e 100644
--- a/unit/test-gdbus-client.c
+++ b/unit/test-gdbus-client.c
@@ -78,6 +78,9 @@ static struct context *create_context(void)
 		return NULL;
 	}
 
+	/* Avoid D-Bus library calling _exit() before next test finishes. */
+	dbus_connection_set_exit_on_disconnect(context->dbus_conn, FALSE);
+
 	return context;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 BlueZ] unit: Avoid D-Bus calling _exit() during SDP tests
  2013-01-10 12:30 ` [PATCH v2 BlueZ] unit: Avoid D-Bus calling _exit() during " Anderson Lizardo
@ 2013-01-10 12:31   ` Johan Hedberg
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hedberg @ 2013-01-10 12:31 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Lizardo,

On Thu, Jan 10, 2013, Anderson Lizardo wrote:
> While running tests, the D-Bus library was set to call _exit() when the
> client leaves the bus. This caused the second test to be interrupted
> without providing a PASS/FAIL result. This was confirmed by running
> test-sdp with DBUS_VERBOSE=1.
> 
> This commit disables this behavior, which does not exist on BlueZ
> because g_dbus_set_disconnect_function() implicitly does this.
> ---
>  unit/test-gdbus-client.c |    3 +++
>  1 file changed, 3 insertions(+)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-10 12:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10  1:03 [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests Anderson Lizardo
2013-01-10  1:03 ` [PATCH BlueZ 2/2] unit: Print D-Bus error message in verbose mode Anderson Lizardo
2013-01-10  1:22   ` Marcel Holtmann
2013-01-10  1:21 ` [PATCH BlueZ 1/2] unit: Fix intermitent failure of SDP tests Marcel Holtmann
2013-01-10 12:30 ` [PATCH v2 BlueZ] unit: Avoid D-Bus calling _exit() during " Anderson Lizardo
2013-01-10 12:31   ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).