[glib] gdbus-serialization: use check_serialization() instead of dbus-daemon
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gdbus-serialization: use check_serialization() instead of dbus-daemon
- Date: Fri, 8 May 2015 15:18:32 +0000 (UTC)
commit f42d2c1b54541cf8d4e399f5c6d27d3ac40fc1a9
Author: Simon McVittie <simon mcvittie collabora co uk>
Date: Tue Apr 21 20:46:47 2015 +0100
gdbus-serialization: use check_serialization() instead of dbus-daemon
This test originally did not connect to the bus, which meant it was
omitted from commits like 415a8d81 that made sure none of GLib tests
rely on the presence of an existing session bus. (In particular,
Debian autobuilders don't have a session bus.)
When test_double_array() was added, environments like the Debian
autobuilders didn't catch the fact that this test relied on having a
session bus, because it is often skipped in minimal environments
due to its libdbus-1 dependency.
We don't actually need to connect to a dbus-daemon here: it's enough
to convert the message from GVariant to D-Bus serialization, and
back into an in-memory representation through libdbus. That's what
check_serialization() does, and I've verified that when I re-introduce
bug #732754 by reverting commits 627b49b and 2268628 locally, this
test still fails.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=744895
Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
Reviewed-by: Colin Walters <walters verbum org>
gio/tests/gdbus-serialization.c | 26 ++++++++------------------
1 files changed, 8 insertions(+), 18 deletions(-)
---
diff --git a/gio/tests/gdbus-serialization.c b/gio/tests/gdbus-serialization.c
index d01ab1f..a405189 100644
--- a/gio/tests/gdbus-serialization.c
+++ b/gio/tests/gdbus-serialization.c
@@ -1060,33 +1060,23 @@ message_parse_empty_arrays_of_arrays (void)
static void
test_double_array (void)
{
- GDBusConnection *conn;
- GError *error = NULL;
GVariantBuilder builder;
+ GVariant *body;
g_test_bug ("732754");
- conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
- g_assert_no_error (error);
-
g_variant_builder_init (&builder, G_VARIANT_TYPE ("ad"));
g_variant_builder_add (&builder, "d", (gdouble)0.0);
g_variant_builder_add (&builder, "d", (gdouble)8.0);
g_variant_builder_add (&builder, "d", (gdouble)22.0);
g_variant_builder_add (&builder, "d", (gdouble)0.0);
-
- /*
- * Some versions of glib encoded arrays of doubles wrong. Here we send such
- * a message and check that we didn't get bumped from the connection.
- */
- g_dbus_connection_call_sync (conn, "org.freedesktop.DBus", "/path",
- "org.freedesktop.DBus", "InvalidNonExistantMethod",
- g_variant_new ("(@ad)", g_variant_builder_end (&builder)),
- NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, &error);
- g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
- g_error_free (error);
-
- g_object_unref (conn);
+ body = g_variant_new ("(@ad)", g_variant_builder_end (&builder));
+ check_serialization (body,
+ "value 0: array:\n"
+ " double: 0.000000\n"
+ " double: 8.000000\n"
+ " double: 22.000000\n"
+ " double: 0.000000\n");
}
/* ---------------------------------------------------------------------------------------------------- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]