libnm-glib: drop separate test library

Previously, we built a second copy of libnm-glib that was hacked to
use the session bus rather than the system bus, for use by the test
programs. Rather than doing that, just have test-nm-client explicitly
override the choice of bus. (test-remote-settings-client was actually
already doing this, although it leaked the bus after.)
This commit is contained in:
Dan Winship 2014-06-20 10:19:37 -04:00
parent 2570c5a17c
commit 3aad3124f1
5 changed files with 17 additions and 32 deletions

View file

@ -18,8 +18,7 @@ BUILT_SOURCES = \
noinst_LTLIBRARIES = \
libdeprecated-nm-glib.la \
libnm-glib-test.la
libdeprecated-nm-glib.la
#####################################################
# Deprecated original libnm_glib bits
@ -176,27 +175,6 @@ libnm_glib_vpn_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib-vpn.ver \
BUILT_SOURCES += $(GLIB_GENERATED)
#####################################################
# Test libnm-glib stuff
#####################################################
libnm_glib_test_la_CFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
$(GUDEV_CFLAGS) \
-DLIBNM_GLIB_TEST \
-DNMRUNDIR=\"$(nmrundir)\"
libnm_glib_test_la_SOURCES = \
$(libnminclude_HEADERS) \
$(libnm_glib_la_SOURCES)
libnm_glib_test_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(GLIB_LIBS) \
$(DBUS_LIBS) \
$(GUDEV_LIBS)
#####################################################
nm-vpn-plugin-glue.h: $(top_srcdir)/introspection/nm-vpn-plugin.xml

View file

@ -68,13 +68,8 @@ _nm_dbus_new_connection (GError **error)
}
#endif
if (connection == NULL) {
#ifdef LIBNM_GLIB_TEST
connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
#else
if (connection == NULL)
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, error);
#endif
}
return connection;
}

View file

@ -19,7 +19,7 @@ test_nm_client_SOURCES = \
test_nm_client_LDADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(top_builddir)/libnm-glib/libnm-glib-test.la \
$(top_builddir)/libnm-glib/libnm-glib.la \
$(GLIB_LIBS) \
$(DBUS_LIBS)
@ -30,7 +30,7 @@ test_remote_settings_client_SOURCES = \
test_remote_settings_client_LDADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(top_builddir)/libnm-glib/libnm-glib-test.la \
$(top_builddir)/libnm-glib/libnm-glib.la \
$(GLIB_LIBS) \
$(DBUS_LIBS)

View file

@ -127,6 +127,7 @@ name_exists (GDBusConnection *c, const char *name)
static ServiceInfo *
service_init (void)
{
DBusGConnection *bus;
ServiceInfo *sinfo;
const char *args[2] = { fake_exec, NULL };
GError *error = NULL;
@ -165,9 +166,19 @@ service_init (void)
NULL, NULL);
test_assert (sinfo->proxy);
sinfo->client = nm_client_new ();
bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
g_assert_no_error (error);
sinfo->client = g_object_new (NM_TYPE_CLIENT,
NM_OBJECT_DBUS_CONNECTION, bus,
NM_OBJECT_DBUS_PATH, NM_DBUS_PATH,
NULL);
test_assert (sinfo->client != NULL);
dbus_g_connection_unref (bus);
g_initable_init (G_INITABLE (sinfo->client), NULL, &error);
g_assert_no_error (error);
return sinfo;
}

View file

@ -392,6 +392,7 @@ main (int argc, char **argv)
ret = g_test_run ();
cleanup ();
dbus_g_connection_unref (bus);
return ret;
}